File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -97,6 +97,38 @@ class test{
97
97
}
98
98
```
99
99
100
+ # Algorithm in collections
101
+ ``` java:
102
+
103
+ import java.util.*;
104
+
105
+ class test{
106
+ public static void main(String []argc){
107
+ ArrayList<Integer> lis = new ArrayList<Integer>();
108
+ lis.add(86);
109
+ lis.add(54);
110
+ lis.add(29);
111
+ lis.add(66);
112
+ lis.add(73);
113
+ lis.add(16);
114
+ lis.add(1);
115
+ System.out.println("Array Data : " + lis);
116
+ Collections.sort(lis);
117
+ System.out.println("After Sort Algo: " + lis);
118
+ Collections.shuffle(lis);
119
+ System.out.println("After Shuffle Algo: " + lis);
120
+ Collections.reverse(lis);
121
+ System.out.println("After Reverse Algo: " + lis);
122
+ Collections.swap(lis,0,1);
123
+ System.out.println("After Swap Algo: " + lis);
124
+ Collections.rotate(lis,2);
125
+ System.out.println("After Rotate Algo: " + lis);
126
+ Collections.frequency(lis,5);
127
+ System.out.println("After frequency Algo : " + lis);
128
+
129
+ }
130
+ }
131
+ ```
100
132
101
133
102
134
You can’t perform that action at this time.
0 commit comments