Package org.ujorm.tools.common
Class StreamUtils
java.lang.Object
org.ujorm.tools.common.StreamUtils
Static methods
- Author:
- Pavel Ponec
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> @NotNull Collector<T,?, ArrayDeque<T>> A stream collecetor to a ArrayDeque typeRead a String.Returns a stream of lines form URL resourcestatic <D,R> @NotNull Joinable<D, R> toJoinable(@NotNull Function<D, R> fce) Create a joinable functionstatic <T> Stream<T>Convert an interator to a Streamstatic <T> Stream<T>Convert an interator to a Stream
-
Method Details
-
rows
Read a String. A line separator can be modifed in the result- Returns:
- The result must be closed.
-
rowsOfUrl
Returns a stream of lines form URL resource- Parameters:
url- An URL link to a resource- Returns:
- The customer is responsible for closing the stream. During closing, an IllegalStateException may occur due to an IOException.
- Throws:
IOException
-
toStream
Convert an interator to a Stream- Type Parameters:
T- An item type- Parameters:
iterator- Source iterator- Returns:
-
toStream
Convert an interator to a Stream- Type Parameters:
T- An item type- Parameters:
iterator- Source iteratorparallel- Parrallell processing is enabled- Returns:
-
collectToDequeue
A stream collecetor to a ArrayDeque type -
toJoinable
@NotNull public static <D,R> @NotNull Joinable<D,R> toJoinable(@NotNull @NotNull Function<D, R> fce) Create a joinable functionUsage
Assert.java:54Function<Person, String> nameProvider = Joinable .of (Person::getBoss) .add(Person::getBoss) .add(Person::getName); String superBossName = nameProvider.apply(getPerson());- Type Parameters:
D- Domain valueR- Result value- Parameters:
fce- An original function- Returns:
- The new object type of Function
-