Package org.openstreetmap.josm.tools
Class StreamUtils
- java.lang.Object
-
- org.openstreetmap.josm.tools.StreamUtils
-
public final class StreamUtils extends java.lang.Object
Utility methods for streams.
-
-
Constructor Summary
Constructors Modifier Constructor Description private
StreamUtils()
Utility class
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> java.util.stream.Stream<T>
reversedStream(java.util.List<T> list)
Creates a stream iterating the list in reversed orderstatic java.util.stream.Collector<java.lang.String,?,java.lang.String>
toHtmlList()
Creates a new Collector that collects the items and returns them as HTML unordered list.static <T> java.util.stream.Stream<T>
toStream(java.lang.Iterable<T> iterable)
Returns a sequentialStream
with the iterable as its source.static <T> java.util.stream.Collector<T,?,java.util.List<T>>
toUnmodifiableList()
Creates a new Collector that collects the items in an unmodifiable list
-
-
-
Constructor Detail
-
StreamUtils
private StreamUtils()
Utility class
-
-
Method Detail
-
toStream
public static <T> java.util.stream.Stream<T> toStream(java.lang.Iterable<T> iterable)
Returns a sequentialStream
with the iterable as its source.- Type Parameters:
T
- The element type to iterate over- Parameters:
iterable
- The iterable- Returns:
- The stream of for that iterable.
- Since:
- 10718
-
reversedStream
public static <T> java.util.stream.Stream<T> reversedStream(java.util.List<T> list)
Creates a stream iterating the list in reversed order- Type Parameters:
T
- the type of elements in the list- Parameters:
list
- the list to iterate over- Returns:
- a stream iterating the list in reversed order
- Since:
- 15732
-
toHtmlList
public static java.util.stream.Collector<java.lang.String,?,java.lang.String> toHtmlList()
Creates a new Collector that collects the items and returns them as HTML unordered list.- Returns:
- The collector.
- Since:
- 10638
-
toUnmodifiableList
public static <T> java.util.stream.Collector<T,?,java.util.List<T>> toUnmodifiableList()
Creates a new Collector that collects the items in an unmodifiable list- Type Parameters:
T
- the type of the input elements- Returns:
- a new Collector that collects the items in an unmodifiable list
- Since:
- 16436
- See Also:
Utils.toUnmodifiableList(java.util.Collection<T>)
-
-