Here you can find the source of stream(Object values)
public static Stream<Object> stream(Object values)
//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); } }