- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBigSort.java
More file actions
Latest commit
21 lines (19 loc) · 657 Bytes
/
Copy pathBigSort.java
File metadata and controls
21 lines (19 loc) · 657 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
importjava.util.*;
importjava.lang.String;
publicclassBigSort {
publicstaticList<String> bigSorting(List<String> unsorted) {
// Write your code here
Collections.sort(unsorted,
(x, y) -> x.length() == y.length() ? x.compareTo(y) : Integer.compare(x.length(), y.length()));
returnunsorted;
}
publicstaticvoidmain(String[] args) {
List<String> gfg = newArrayList<String>();
String[] ar = { "31415926535897932384626433832795", "1", "3", "10", "3", "5" };
for (inti = 0; i < ar.length; i++) {
gfg.add(ar[i]);
}
List<String> result = BigSort.bigSorting(gfg);
System.out.println(result);
}
}