Advertisement
kuchuz

PBO-C 5 : InputReader()

Nov 26th, 2020
580
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 InputReader
  4. {
  5.     private Scanner reader;
  6.      
  7.     public InputReader()
  8.     {
  9.         reader = new Scanner(System.in);
  10.     }
  11.      
  12.     public HashSet<String> getInput()
  13.     {
  14.         System.out.println("> ");
  15.         String inputLine = reader.nextLine().trim().toLowerCase();
  16.         String[] wordArray = inputLine.split(" ");
  17.         HashSet<String> words = new HashSet<String>();
  18.        
  19.         for(String word: wordArray)
  20.         {
  21.             words.add(word);
  22.         }
  23.        
  24.         return words;
  25.     }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement