-
Notifications
You must be signed in to change notification settings - Fork 0
/
Peakele.java
84 lines (63 loc) · 2.41 KB
/
Peakele.java
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
import java.util.*;
public class Peakele {
public static void helloprint(){
System.out.println("hello");
}
public static void main(String[] args){
/*
ArrayList<Integer> a = new ArrayList<>();
a.add(1);
a.add(2);
a.add(3);
a.forEach(e -> System.out.println(e));
ArrayList<Integer> b = new ArrayList<>(Collections.nCopies(5,-1));
System.out.println(b);
b.add(01);
b.add(02);
b.add(03);
b.forEach(e -> System.out.println(e));
*/
/*
Map<String, String> map = new HashMap<>();
map.put("Name", "Aman");
map.put("Address", "Kolkata");
// Print the map
System.out.println("Map: " + map);
// remap the values using compute() method
map.compute("Name", (a, b)
-> b.concat(" Singh"));
map.compute("Address", (key, val)
-> val.concat(" West-Bengal"));
// print new mapping
System.out.println("New Map: " + map);
map.merge("Yogesh", "Gowda", (a,b) -> b.concat(b));
System.out.println(map); // expected : Yogesh=Gowda
map.merge("Yogesh", "Great", (a,b) -> null);
System.out.println(map); // expected: Yogesh=null
map.merge("Yogesh", "GreatGowda", (a,b) -> null);
System.out.println(map); //expected: Yogesh=GreatGowda
map.put("hello", null);
System.out.println(map.get("hello"));
List<Integer> ar = Collections.nCopies(5,-1);
List<Integer> arlist = new ArrayList<>(Collections.nCopies(5,-1));
arlist.add(1);
arlist.add(2);
arlist.add(3);
arlist.add(4);
int[] a = new int[5];
ArrayList<Integer> dummy = new ArrayList<>();
TreeMap<Integer,Integer> tm = new TreeMap<>();
tm.put(1,1);
tm.put(2,2);
tm.put(3,3);
tm.put(4,4);
tm.forEach((c,d)-> System.out.print(c +"-"+d + " "));
int dum = tm.computeIfAbsent(4, k -> null);
tm.forEach((c,d) -> System.out.println(c+""+d+" "));
Map.Entry<Integer,Integer> me = tm.firstEntry();
System.out.println(me.getKey());
*/
StringBuilder sb = new StringBuilder("ABCD");
System.out.println(new String("ABCD").equals(sb));
}
}