Stream.peek() javadoc

Richard Warburton richard.warburton at gmail.com
Thu Aug 22 03:00:42 PDT 2013


Hi,

The current code snippet in stream.peek() seems to be a bit out of date.
 Its currently:

     list.stream()
         .filter(filteringFunction)
         .peek(e -> {System.out.println("Filtered value: " + e); });
         .map(mappingFunction)
         .peek(e -> {System.out.println("Mapped value: " + e); });
         .collect(Collectors.intoList());

I suggest changing this to:

     list.stream()
         .filter(filteringFunction)
         .peek(e -> System.out.println("Filtered value: " + e));
         .map(mappingFunction)
         .peek(e -> System.out.println("Mapped value: " + e));
         .collect(Collectors.toList());

regards,

  Dr. Richard Warburton

  http://insightfullogic.com
  @RichardWarburto <http://twitter.com/richardwarburto>


More information about the lambda-dev mailing list