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.*; | |
public class LambdaStream | |
{ | |
public static void main(String args[]) | |
{ | |
String[] values={"Argentine","Angola","Brussels","Brazil"}; | |
List<String> list=Arrays.asList(values); | |
list.stream().filter(s->s.length()>6).map(s->"["+s+"]").forEach(System.out::println); | |
} | |
} |
下記のコードでは要素の文字長を指定し、表示するものです。
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.*; | |
public class LambdaStream | |
{ | |
public static void main(String args[]) | |
{ | |
String[] values={"Argentine","Angola","Brussels","Brazil"}; | |
List<String> list=Arrays.asList(values); | |
list.stream().filter(s->s.length()>6).map(s->"["+s+"]").forEach(System.out::println); | |
} | |
} |
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.*; | |
public class LambdaTest | |
{ | |
public static void main(String args[]) | |
{ | |
String[] values={"Argentine","Angola","Brussels","Brazil"}; | |
List<String> list=Arrays.asList(values); | |
list.stream().filter(e->e.startsWith("A")).forEach(e->System.out.println(e)); | |
} | |
} |