Last active
August 29, 2015 14:10
-
-
Save kamekoopa/bf941dd1bb449aff79ab to your computer and use it in GitHub Desktop.
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
public class Stream { | |
public static void main(String[] args) { | |
Optional<String> result = Optional.empty(); | |
for(String lang : Arrays.asList("C++", "Go", "Java", "Python", "Ruby")){ | |
String _lang = lang.toUpperCase(); | |
System.out.println("toUppercase(" + _lang + ")"); | |
System.out.println("length(" + _lang + ")"); | |
if(_lang.length() == 4){ | |
result = Optional.of(_lang); | |
break; | |
} | |
} | |
} | |
} |
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
/** http://itpro.nikkeibp.co.jp/atcl/column/14/224071/092600006/ のやつ */ | |
public class Stream2 { | |
public static void main(String[] args){ | |
for(int x : Arrays.asList(0,1,2,3,4,5)){ | |
System.out.println("filter: " + x); | |
if(x%2==0){ | |
System.out.println("map: " + x); | |
int _x = x/2; | |
System.out.println("forEach: " + _x); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment