Advertisement
nocturnalmk

Untitled

Nov 27th, 2012
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.62 KB | None | 0 0
  1.         Scanner scan = new Scanner(inputStream);
  2.         String word, sortedWord;
  3.  
  4.         HashMap<String, ArrayList<String>> words = new HashMap<String, ArrayList<String>>();
  5.  
  6.         while ((word = scan.next()) != null) {
  7.             sortedWord = sortWord(word);
  8.  
  9.             if (words.get(sortedWord) != null) {
  10.                 ArrayList<String> tmp = words.get(sortedWord);
  11.                 if (tmp == null) {
  12.                     tmp = new ArrayList<String>();
  13.                 }
  14.                 tmp.add(word);
  15.                 words.put(sortedWord, tmp);
  16.             } else {
  17.                 ArrayList<String> tmp = new ArrayList<String>();
  18.                 tmp.add(word);
  19.                 words.put(sortedWord, tmp);
  20.             }
  21.         }      
  22.        
  23.         System.out.println("iteratori start");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement