Pastebin launched a little side project called HostCabi.net, check it out ;-)Don't like ads? PRO users don't see any ads ;-)
Guest

newkeyiterator

By: ace on Feb 6th, 2010  |  syntax: None  |  size: 0.69 KB  |  hits: 40  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. public String generateResponse(HashSet<String> words)
  2.     {
  3.         Iterator<String> it = words.iterator();
  4.         while(it.hasNext())
  5.         {
  6.             String word = it.next();
  7.            
  8.                 ArrayList<String> keys = new ArrayList<String>();
  9.                 keys.addAll(responseMap.keySet());
  10.                     while(keys.hasNext())
  11.                     {
  12.                         String key = keys.next();
  13.                             if (word.contains(key))
  14.                        {    
  15.            
  16.             String response = responseMap.get(word);
  17.             if(response != null)
  18.             {
  19.                 return response;
  20.             }
  21.      
  22.     }
  23. }