Currently whenever I need to create stream from an array, I do
String[] array = {\"x1\", \"x2\"};
Arrays.asList(array).stream();
Is there s
Alternative to @sol4me's solution:
Stream.of(theArray)
Of the difference between this and Arrays.stream(): it does make a difference if your array is of a primitive type. For instance, if you do:
Arrays.stream(someArray)
where someArray is a long[], it will return a LongStream. Stream.of(), on the other hand, will return a Stream with a single element.