-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathFunctionalProgrammingLesson.java
More file actions
100 lines (62 loc) · 1.77 KB
/
FunctionalProgrammingLesson.java
File metadata and controls
100 lines (62 loc) · 1.77 KB
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
package java8;
import sun.plugin2.message.Conversation;
import sun.plugin2.message.Message;
import sun.plugin2.message.Serializer;
import java.io.IOException;
import java.nio.channels.Channel;
import java.util.Date;
import java.util.function.Function;
public class FunctionalProgrammingLesson {
public static void main(String[] args) {
for(String s : args) {
}
}
public int square(int x) {
return x * x;
}
public void processNext() {
Message message = InboxQueue.popMessage();
if (message != null) {
process(message);
}
}
public boolean processMessage(Channel channel) {
//...
return true || false;
}
public Program getCurrentProgram(TVGuide guide, int channel) {
Schedule schedule = guide.getSchedule(channel);
Program current = schedule.programAt(new Date());
return current;
}
public Program getProgramAt(TVGuide guide, int channel, Date when) {
Schedule schedule = guide.getSchedule(channel);
Program program = schedule.programAt(when);
return program;
}
Function<Integer,Integer> add1 = x -> x * x;
void process(Message message) {
}
}
class Schedule{
public Program programAt(Date date) {
return new Program();
}
}
class TVGuide{
public Schedule getSchedule(int ch) {return new Schedule();}
}
class Program{
}
class InboxQueue {
static Message popMessage() {
return new Message(5, new Conversation()) {
@Override
public void writeFields(Serializer serializer) throws IOException {
}
@Override
public void readFields(Serializer serializer) throws IOException {
}
};
}
}