Hello so I sorting list in the java in Collection.reverse(list); I have this code Code (Java): List<Integer> list = new ArrayList<Integer>(); list.add(5); list.add(6); list.add(10); list.add(20); Collections.reverse(list); for(Integer i : list) { System.out.println(i); } but its printing Code (Java): -20 20 10 6 5
The method is called reverse. What did you think it would do. Use the sort method. Collection.sort(...)
yes I already did sorry for not including it on this post got fixed already in another thread sorry for double posting.