Java Stream of stream(Object values)

Here you can find the source of stream(Object values)

Description

stream

License

Apache License

Declaration

public static Stream<Object> stream(Object values) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.util.*;

import java.util.stream.*;

public class Main {
    public static Stream<Object> stream(Object values) {
        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();
            return StreamSupport.stream(spliterator, false);
        }//  w ww  .  j a  v  a 2  s  . c o m
        return Stream.of(values);
    }
}

Related

  1. stream(Iterable input)
  2. stream(Iterable iterable)
  3. stream(Iterable iterable)
  4. stream(Iterable it)
  5. stream(Iterator iterator)
  6. streamEquals(Stream a, Stream b)
  7. streamInt(int max)
  8. streamOf (final Iterable iterable)
  9. streamOf(Iterable it)