Douma37

TrollSort mk1

May 31st, 2019
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.56 KB | None | 0 0
  1. import java.util.*;
  2.  
  3. public class Troll {
  4.   private static void trollSort(List<Integer> list) {
  5.     if (list.size() > 1) {
  6.       Collections.sort(list);
  7.     }
  8.  
  9.  
  10.   }
  11.   public static void main(String[] args) {
  12.     Scanner scanner = new Scanner(System.in);
  13.     List<Integer> list = new ArrayList<>();
  14.     while (scanner.hasNextInt()) {
  15.       list.add(scanner.nextInt());
  16.     }
  17.     trollSort(list);
  18.     for(int i = 0; i < list.size(); i++) {
  19.       if (i != 0) {
  20.         System.out.print(" ");
  21.       }
  22.       System.out.print(list.get(i));
  23.     }
  24.   }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment