List of utility methods to do Stream Operation
Object[][] | arrayWrap(final Stream> stream) Produces array of stream's elements wrapped into arrays. return stream.map(s -> new Object[] { s }).collect(toList()).toArray(new Object[0][]); |
List> | asList(Stream> stream) Cast stream as list return stream == null ? null : Arrays.asList(stream.toArray());
|
String | buildInvalidArgsError(Stream build Invalid Args Error return "Values [" + values.map(String::valueOf).collect(Collectors.joining(", ")) + "] cannot be coerced to [" + types.map(Class::getSimpleName).collect(Collectors.joining(", ")) + "]"; |
IntStream | bytesToIntStream(byte[] bytes) bytes To Int Stream return IntStream.range(0, bytes.length).map(i -> bytes[i] & 0xFF);
|
Stream | cast(Stream Cast all elements in a stream to a given type, possibly throwing a ClassCastException . return stream.map(type::cast);
|
Stream | cat(Stream Concatenate an array of streams into one stream. return Arrays.stream(streams).reduce(Stream.empty(), Stream::concat);
|
Stream | characterStream2(String s) character Stream IntStream is = IntStream.range(0, s.length());
return is.mapToObj(s::charAt);
|
String | commaSeparated(Stream comma Separated return stream.collect(Collectors.joining(LIST_SEPARATOR));
|
IntStream | concat(IntStream... streams) concat return Arrays.stream(streams).reduce(IntStream::concat).orElse(IntStream.empty());
|
Stream | concat(Stream Concats any number of Streams not just 2 as in Stream#concat(Stream,Stream) . return Stream.of(streams).reduce(Stream::concat).orElse(Stream.empty());
|