I have a very basic java code . There are 2 hash tables :
Hashtable<String, ArrayList<tuple> > htDOC1 = new Hashtable<String, ArrayList<tuple> >();
    Hashtable<String, ArrayList<tuple> > htDOC2 = new Hashtable<String, ArrayList<tuple> >();
Each key represents a word as you can see String.Then i have a method which takes 2 hash tables as a parameters :
 public static void CheckCheaters(Hashtable<String, ArrayList<tuple> > doc1 ,Hashtable<String, ArrayList<tuple> > doc2 ){
    Set <String> keysDoc1 =  doc1.keySet();
    Set <String> keysDoc2 =  doc2.keySet();
}
in the KeysDoc1 I've stored the keys of the first hash table , in the keysDoc2 I've stored the keys of the second hash table.
I want to loop over the two sets and check if the first 5 elements of the keysDoc1 are equal to the first 5 elements of keysDoc2 , then check the next 5 ..etc
could you please guide me ? i hope i was clear , i tried my best.
EDIT
 public static boolean CheckCheaters(SortedMap<String, ArrayList<tuple> > doc1 ,SortedMap<String, ArrayList<tuple> > doc2 ){
     boolean checking=true;
      Set<String> keysDoc1 =  doc1.keySet();
      Set<String> keysDoc2 =  doc2.keySet();
      int count = 0;
      for(String s : keysDoc1)
      {
          if(keysDoc2.contains(s))
              count++;
      }
      if(count>5) {
          checking=true;
      }
      else {
          checking=false;
      }
      return checking;
     }
 }
 
     
    