Skip to content

Instantly share code, notes, and snippets.

@Hafiz-Waleed-Hussain
Created March 12, 2017 11:14
Show Gist options
  • Save Hafiz-Waleed-Hussain/9f55be929eb0f5e1956e75ac41876a3b to your computer and use it in GitHub Desktop.
Save Hafiz-Waleed-Hussain/9f55be929eb0f5e1956e75ac41876a3b to your computer and use it in GitHub Desktop.
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