The Artima Developer Community
Sponsored Link

Java Buzz Forum
Uses and limitations of the Stream API in Java 8

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
News Manager

Posts: 47623
Nickname: newsman
Registered: Apr, 2003

News Manager is the force behind the news at Artima.com.
Uses and limitations of the Stream API in Java 8 Posted: Feb 6, 2014 6:11 PM
Reply to this message Reply

This post originated from an RSS feed registered with Java Buzz by News Manager.
Original Post: Uses and limitations of the Stream API in Java 8
Feed Title: JavaWorld
Feed URL: http://www.javaworld.com/index.rss
Feed Description: JavaWorld.com: Fueling Innovation
Latest Java Buzz Posts
Latest Java Buzz Posts by News Manager
Latest Posts From JavaWorld

Advertisement

The Stream API in JDK 8 promises to bring a lot of expressive power to the Java language. However, the API and the framework do have some limitations. Compared to frameworks in other languages, some key features are missing, including stateless lambda expressions.

Software Engineering blogger David Hartveld rounds out his series of three posts focusing on Java 8 with one introducing the Stream API, demonstrating its extensive use of lambda expressions. Here, he compares a pre-Java 8 for-loop:


List<Block> blocks = /* ... */;
 
int sumOfWeights = 0;
for (Block block : blocks) {
  if (block.getColor() == Color.RED) {
    sumOfWeights += block.getWeight();
  }
}

to one expressed with the JDK 8 Stream API:

To read this article in full or to leave a comment, please click here

Read: Uses and limitations of the Stream API in Java 8

Topic: The Single Responsibility Principle Previous Topic   Next Topic Topic: Prevent automounting volumes in OS X

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use