Guest User

Reader

a guest
Nov 16th, 2020
40
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.70 KB | None | 0 0
  1. import java.util.*;
  2.  
  3. /**
  4.  * Class untuk menerima inputan yang nantinya dikirimkan ke class SupportSystem.
  5.  *
  6.  * @author M.Fajri Davyza Chaniago
  7.  * @version 16 November 2020
  8.  */
  9. public class InputReader
  10. {
  11.    private Scanner reader;
  12.    
  13.    public InputReader()
  14.    {
  15.        reader = new Scanner(System.in);
  16.    }
  17.    
  18.    public HashSet<String> getInput()
  19.    {
  20.        System.out.print("> ");
  21.        String inputLine = reader.nextLine().trim().toLowerCase();
  22.        String[] wordArray = inputLine.split(" ");
  23.        
  24.        HashSet<String> words = new HashSet<String>();
  25.        for (String word : wordArray)
  26.        {
  27.            words.add(word);
  28.        }
  29.        
  30.        return words;
  31.    }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment