Advertisement
makispaiktis

I4. Collections.sort()

Jun 6th, 2022 (edited)
1,198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.41 KB | None | 0 0
  1. import java.util.*;
  2.  
  3. public class myClass {
  4.  
  5.     public static void main(String[] args){
  6.         String[] crap = {"apples", "lemons", "geese", "bacon", "youtube"};
  7.         List<String> l1 = Arrays.asList(crap);
  8.         System.out.println(l1);
  9.         Collections.sort(l1);
  10.         System.out.println(l1);
  11.         Collections.sort(l1, Collections.reverseOrder());
  12.         System.out.println(l1);
  13.     }
  14. }
  15.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement