-
Notifications
You must be signed in to change notification settings - Fork 0
/
Mapdemo3.java
47 lines (36 loc) · 1.4 KB
/
Mapdemo3.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
package node;
import java.util.ArrayList;
import java.util.Collections;
public class Mapdemo3 {
public static void main(String[] args) {
Product product1 = new Product("Glass", 1);
Product product2 = new Product("Wood", 2);
Product product3 = new Product("SimCard", 3);
ArrayList<Product> arrayList = new ArrayList<>();
arrayList.add(product1);
arrayList.add(product3);
arrayList.add(product2);
// System.out.println(arrayList.toString());
// Collections.rotate(arrayList, 1);
// System.out.println(arrayList.toString());
// Collections.rotate(arrayList, 1);
// System.out.println(arrayList.toString());
// Collections.rotate(arrayList, 1);
// System.out.println(arrayList.toString());
// Collections.rotate(arrayList, 1);
//
// System.out.println(arrayList);
// Collections.shuffle(arrayList);
// System.out.println(arrayList);
// Collections.shuffle(arrayList);
// System.out.println(arrayList);
// Collections.shuffle(arrayList);
System.out.println(arrayList);
Collections.sort(arrayList, Product.BY_NANME);
System.out.println(arrayList);
Collections.singleton(1);
Collections.emptySet();
arrayList.sort(Product.BY_WEIGHT);
System.out.println(arrayList);
}
}