Class StreamUtils


  • public class StreamUtils
    extends java.lang.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 Summary

      Constructors 
      Constructor Description
      StreamUtils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <T> java.util.stream.Collector<T,​?,​java.util.List<T>> toUnmodifiableList()
      Return a collector that collects a Stream into an unmodifiable list.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • StreamUtils

        public StreamUtils()
    • Method Detail

      • toUnmodifiableList

        public static <T> java.util.stream.Collector<T,​?,​java.util.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.