Created
March 12, 2017 11:14
-
-
Save Hafiz-Waleed-Hussain/9f55be929eb0f5e1956e75ac41876a3b to your computer and use it in GitHub Desktop.
HelloWorldStream using Java8 API example.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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