I've been learning how to use streams and lambda expressions, and came across this question.
What is the difference between:
Arrays.asList(myDogs).forEach((d) -> {System.out.println(d.toString());
actAsDog(d);});
and this:
Arrays.asList(myDogs).stream().forEach((d) -> {System.out.println(d.toString());
actAsDog(d);});
They both produce the exact same result, one by making a stream of the list and the other by using an iterator. Is there any other differences that I don't know about, and is one better than the other?