Java Utililty Methods Stream of

List of utility methods to do Stream of

Description

The list of methods to do Stream of are organized into topic(s).

Method

Streamstream(Object values)
stream
if (values == null)
    return Stream.empty();
if (values instanceof Collection)
    return ((Collection) values).stream();
if (values instanceof Object[])
    return Stream.of(((Object[]) values));
if (values instanceof Iterable) {
    Spliterator<Object> spliterator = ((Iterable) values).spliterator();
...
booleanstreamEquals(Stream a, Stream b)
stream Equals
if (a == null && b == null) {
    return true;
if (a == null || b == null) {
    return false;
final Iterator<T> iterA = a.iterator();
final Iterator<T> iterB = b.iterator();
...
IntStreamstreamInt(int max)
stream Int
return streamInt(0, 1, max);
StreamstreamOf(final Iterable iterable)
Wrap an iterable in a stream
return streamOf(iterable.iterator());
StreamstreamOf(Iterable it)
stream Of
return StreamSupport.stream(it.spliterator(), false);
StreamstreamOf(Iterable iterable)
stream Of
return StreamSupport.stream(iterable.spliterator(), false);
Streamstreamof(Iterable vals)
streamof
return streamof(vals, false);
StreamstreamOf(T value)
Stream or value or empty stream if value is null.
return Optional.ofNullable(value).map(Stream::of).orElseGet(Stream::empty);
StreamstreamOfEnumeration(Enumeration e, boolean parallel)
convert Enumeration to the Stream
return StreamSupport.stream(Spliterators.spliteratorUnknownSize(new Iterator<E>() {
    public E next() {
        return e.nextElement();
    public boolean hasNext() {
        return e.hasMoreElements();
}, Spliterator.ORDERED), parallel);
...
StreamstreamOfOptional(Optional element)
stream Of Optional
return Stream.of(element.orElse(null)).filter(e -> e != null);