Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 4d90ed8

Browse files
committed
Lambda Expressions
01-Lambda Expression 02-Scope & Funcional Program' 03-Functional Scope 04-Streams 05-Lambda-Challenge 06-ButtonFX
1 parent 1f640b4 commit 4d90ed8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+1654
-0
lines changed

‎Lamda Expressions/001_LambdaExpression/.idea/misc.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎Lamda Expressions/001_LambdaExpression/.idea/modules.xml

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎Lamda Expressions/001_LambdaExpression/.idea/workspace.xml

Lines changed: 82 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<module type="JAVA_MODULE" version="4">
3+
<component name="NewModuleRootManager" inherit-compiler-output="true">
4+
<exclude-output />
5+
<content url="file://$MODULE_DIR$">
6+
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
7+
</content>
8+
<orderEntry type="inheritedJdk" />
9+
<orderEntry type="sourceFolder" forTests="false" />
10+
</component>
11+
</module>
1.96 KB
Binary file not shown.
758 Bytes
Binary file not shown.
1.47 KB
Binary file not shown.
180 Bytes
Binary file not shown.
Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
import java.util.ArrayList;
2+
import java.util.List;
3+
4+
public class Main {
5+
6+
public static void main(String[] args) {
7+
// new Thread(()-> {
8+
// System.out.println("Printing from the Runnable");
9+
// System.out.println("Line 2");
10+
// System.out.format("This is line %d\n", 3);
11+
// }).start();
12+
13+
14+
Employee john = new Employee("John Doe", 30);
15+
Employee tim = new Employee("Tim Buchalka", 21);
16+
Employee jack = new Employee("Jack Hill", 40);
17+
Employee snow = new Employee("Snow White", 22);
18+
19+
List<Employee> employees = new ArrayList<>();
20+
employees.add(john);
21+
employees.add(tim);
22+
employees.add(jack);
23+
employees.add(snow);
24+
25+
//// Collections.sort(employees, new Comparator<Employee>() {
26+
//// @Override
27+
//// public int compare(Employee employee1, Employee employee2) {
28+
//// return employee1.getName().compareTo(employee2.getName());
29+
//// }
30+
//// });
31+
//
32+
// Collections.sort(employees, (employee1, employee2) ->
33+
// employee1.getName().compareTo(employee2.getName()));
34+
//
35+
// for(Employee employee : employees) {
36+
// System.out.println(employee.getName());
37+
// }
38+
//
39+
//// String sillyString = doStringStuff(new UpperConcat() {
40+
//// @Override
41+
//// public String upperAndConcat(String s1, String s2) {
42+
//// return s1.toUpperCase() + s2.toUpperCase();
43+
//// }
44+
//// },
45+
//// employees.get(0).getName(), employees.get(1).getName());
46+
//// System.out.println(sillyString);
47+
//
48+
// UpperConcat uc = (s1, s2) -> {
49+
// String result = s1.toUpperCase() + s2.toUpperCase();
50+
// return result;
51+
// };
52+
// String sillyString = doStringStuff(uc, employees.get(0).getName(), employees.get(1).getName());
53+
// System.out.println(sillyString);
54+
55+
AnotherClass anotherClass = new AnotherClass();
56+
String s = anotherClass.doSomething();
57+
System.out.println(s);
58+
}
59+
60+
public final static String doStringStuff(UpperConcat uc, String s1, String s2) {
61+
return uc.upperAndConcat(s1, s2);
62+
}
63+
}
64+
65+
class Employee {
66+
private String name;
67+
private int age;
68+
69+
public Employee(String name, int age) {
70+
this.name = name;
71+
this.age = age;
72+
}
73+
74+
public String getName() {
75+
return name;
76+
}
77+
78+
public void setName(String name) {
79+
this.name = name;
80+
}
81+
82+
public int getAge() {
83+
return age;
84+
}
85+
86+
public void setAge(int age) {
87+
this.age = age;
88+
}
89+
}
90+
91+
interface UpperConcat {
92+
public String upperAndConcat(String s1, String s2);
93+
}
94+
95+
class AnotherClass {
96+
97+
public String doSomething() {
98+
int i = 0;
99+
100+
UpperConcat uc = (s1, s2) -> {
101+
System.out.println("The lambda expression's class is " + getClass().getSimpleName());
102+
String result = s1.toUpperCase() + s2.toUpperCase();
103+
return result;
104+
};
105+
106+
System.out.println("The AnotherClass class's name is " + getClass().getSimpleName());
107+
return Main.doStringStuff(uc,"String1","String2");
108+
}
109+
}
110+
111+
112+
113+
114+
115+

‎Lamda Expressions/002_Scope-&-Functional-Program/.idea/misc.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /