public abstract class StreamUtils extends Object
Modifier and Type | Method and Description |
---|---|
static <T> Collector<T,?,ArrayDeque<T>> |
collectToDequeue()
A stream collecetor to a ArrayDeque type
|
static Stream<String> |
rowsOfUrl(URL url)
Returns a stream of lines form URL resource
|
static <D,R> Joinable<D,R> |
toJoinable(Function<D,R> fce)
Create a joinable function
Usage
Function<Person, String> nameProvider = Joinable
.of (Person::getBoss)
.add(Person::getBoss)
.add(Person::getName);
String superBossName = nameProvider.apply(getPerson());
|
static <T> Stream<T> |
toStream(Iterator<T> iterator)
Convert an interator to a Stream
|
static <T> Stream<T> |
toStream(Iterator<T> iterator,
boolean parallel)
Convert an interator to a Stream
|
public static Stream<String> rowsOfUrl(@Nonnull URL url) throws IOException
url
- An URL link to a resourceIOException
public static <T> Stream<T> toStream(@Nonnull Iterator<T> iterator)
T
- An item typeiterator
- Source iteratorpublic static <T> Stream<T> toStream(@Nonnull Iterator<T> iterator, boolean parallel)
T
- An item typeiterator
- Source iteratorparallel
- Parrallell processing is enabled@Nonnull public static <T> Collector<T,?,ArrayDeque<T>> collectToDequeue()
@Nonnull public static <D,R> Joinable<D,R> toJoinable(@Nonnull Function<D,R> fce)
Function<Person, String> nameProvider = Joinable .of (Person::getBoss) .add(Person::getBoss) .add(Person::getName); String superBossName = nameProvider.apply(getPerson());
D
- Domain valueR
- Result valuefce
- An original functionCopyright 2019-2022, Pavel Ponec