-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEx1.java
More file actions
74 lines (42 loc) · 1.18 KB
/
Ex1.java
File metadata and controls
74 lines (42 loc) · 1.18 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
package com.java8.tuples;
import java.util.ArrayList;
import java.util.List;
class Tuple<A, B, C> {
private final A a;
private final B b;
private final C c;
public Tuple(A a, B b, C c) {
super();
this.a = a;
this.b = b;
this.c = c;
}
public A getA() {
return a;
}
public B getB() {
return b;
}
public C getC() {
return c;
}
}
class Emp{}
public class Ex1 {
public static Tuple<String, Integer, Boolean> getMe(){
return new Tuple<String, Integer, Boolean>("Hello",200, true);
}
public static Tuple<String, String, String> getMe1(){
return new Tuple<String, String, String>("hello", "how", "are");
}
public static Tuple<String, String, Emp> getMe2(){
return new Tuple<String, String, Emp>("hello", "how", new Emp());
}
public static void main(String[] args) {
Tuple<String, String, String> myOjb = getMe1();
System.out.println("first " + myOjb.getA());
System.out.println("Second " + myOjb.getB());
System.out.println("Third " + myOjb.getC());
List<Tuple<String, String, String>> mylist = new ArrayList<Tuple<String, String, String>>();
}
}