Java 8 - Type mismatch: cannot convert from List<Serializable> to List<String> Java 8 - Type mismatch: cannot convert from List<Serializable> to List<String> arrays arrays

Java 8 - Type mismatch: cannot convert from List<Serializable> to List<String>


This is an Eclipse bug

Bug 508834, thanks to @Tunaki


Notice the method signatures:

//Stream.of<T> Stream<T> of(T... values)//Arrays.stream<T> Stream<T> stream(T[] array)

Now, for Arrays.stream it is obvious that a call with an array of type T will return a Stream<T>. But with Stream.of should it return Stream<T> or Stream<T[]>? i.e. what is the type of the varags; are you passing your array are the first parameter (so the varargs are an array of arrays) or are you passing your array as all the parameters?

That's your issue.