Category: java experience

Record list custom sorting ascendingdescending order 0

Record list custom sorting ascendingdescending order

Hits: 0List<String> origin = new ArrayList<>(); origin.add("1"); origin.add("3"); origin.add("2"); origin.add("9"); origin.add("5"); origin.add("77"); origin.add("12"); Collections.sort(origin, (o1, o2) -> { int numb1 = Integer.parseInt(o1); int numb2 = Integer.parseInt(o2); if (numb1 > numb2) { return 1 ;...