Class StreamUtils

java.lang.Object
org.bitcoinj.base.internal.StreamUtils

public class StreamUtils extends Object
Stream Utilities. Bitcoinj is moving towards functional-style programming, immutable data structures, and unmodifiable lists. Since we are currently limited to Java 8, this class contains utility methods that can simplify code in many places.
  • Constructor Details

    • StreamUtils

      public StreamUtils()
  • Method Details

    • toUnmodifiableList

      public static <T> Collector<T,?,List<T>> toUnmodifiableList()
      Return a collector that collects a Stream into an unmodifiable list.

      Java 10 provides Collectors.toUnmodifiableList() and Java 16 provides Stream.toList(). If those are not available, use this utility method.