I wonder why Java 8 does not include support to use streams on arrays the same way it does on collections. You can write
Collection<String> myCollection = new ArrayList<String>();
Stream<String> stream = myCollection.stream();
but you cannot write:
String[] myArray = new String[] {};
Stream<String> stream = myArray.stream();
I am aware of the utility method Arrays.stream, so this is can be used instead:
Stream<String> stream = Arrays.stream(myArray);
But it leaves me wondering why this clumsy call of a static utility method is required in a context where lambda expression allow to simply code so much. I am aware of the significant difference between the (object/interface based) world of Collection and the more "native" world of array.
Who can elaborate on this?
Collection. You don't haveArray<String>butString[], this is specific to arraysstreamin particular? What about other methods in theCollectioninterface?