Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
HelloWorldStream using Java8 API example.
import java.util.ArrayList;
import java.util.List;
/**
* Created by waleed on 12/03/2017.
*/
public class HelloWorldStream {
public static void main(String [] args){
List<String> list = new ArrayList<>();
list.add("H");
list.add("e");
list.add("l");
list.add("l");
list.add("o");
list.add(" ");
list.add("W");
list.add("o");
list.add("r");
list.add("l");
list.add("d");
list.stream()
.filter(s -> !s.equals("l"))
.forEach(s-> System.out.print(s));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.