Advertisement
Guest User

Untitled

a guest
Apr 24th, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.31 KB | None | 0 0
  1.  
  2. import java.io.BufferedReader;
  3. import java.io.FileNotFoundException;
  4. import java.io.FileReader;
  5. import java.io.IOException;
  6. import java.io.InputStreamReader;
  7. import java.util.ArrayList;
  8.  
  9. /*
  10. * To change this license header, choose License Headers in Project Properties.
  11. * To change this template file, choose Tools | Templates
  12. * and open the template in the editor.
  13. */
  14.  
  15. /**
  16. *
  17. * @author Attila
  18. */
  19. public class TuraStat {
  20. public static void main(String[] args) throws FileNotFoundException, IOException {
  21. // BufferedReader Console = new BufferedReader(new FileReader("sample.txt"));
  22. BufferedReader Console = new BufferedReader(new InputStreamReader(System.in));
  23. String line;
  24. ArrayList<String> TuraList = new ArrayList<String>();
  25.  
  26. while((line = Console.readLine()) != null){
  27. if(!line.contains(":")){
  28. if(TuraList.contains(line)){
  29. while(TuraList.contains(line)){
  30. TuraList.remove(TuraList.indexOf(line));
  31. }
  32. }else TuraList.add(line);
  33. }
  34. }
  35. TuraList.sort((o1, o2) -> {
  36. return o1.compareTo(o2);
  37. });
  38. for (String string : TuraList) {
  39. System.out.println(string);
  40. }
  41. }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement