-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLambda.java
More file actions
35 lines (28 loc) · 743 Bytes
/
Copy pathLambda.java
File metadata and controls
35 lines (28 loc) · 743 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package com;
import java.text.BreakIterator;
import java.util.ArrayList;
import java.util.List;
interface I {
public void add(int a, int b);
}
public class Lambda {
public static void main(String[] args) {
I i = (int a, int b) -> {
System.out.println("\n **** " + (a + b));
};
i.add(2, 3);
List<String> strings = new ArrayList<String>();
strings.add("babak");
strings.add("amir");
strings.add("parisa");
strings.stream().forEach((string) -> {
if (string.equals("amir")) {
System.out.println("\n **********%%%%%%");
}
System.out.println("\n string is *****" + string);
});
strings.stream().filter(s -> s.equals("amir")).forEach((s1) -> {
System.out.println("\n ***pepe" + "\t" + s1);
});
}
}