protected void checkForDuplicateKeys(Object[] template) throws Exception {
  Hashtable<Object,Object> hash=new Hashtable<Object,Object>();
  int numMatches=0;
  for (int i=0; i < m_Keys.size(); i++) {
    Object[] current=m_Keys.get(i);
    if (!matchesTemplate(template,current)) {
      continue;
    }
    if (hash.containsKey(current[m_KeyIndex])) {
      throw new Exception("Duplicate result received:" + DatabaseUtils.arrayToString(current));
    }
    numMatches++;
    hash.put(current[m_KeyIndex],current[m_KeyIndex]);
  }
  if (numMatches != m_ExpectedResultsPerAverage) {
    throw new Exception("Expected " + m_ExpectedResultsPerAverage + " results matching key \""+ DatabaseUtils.arrayToString(template)+ "\" but got "+ numMatches);
  }
}

protected void checkForDuplicateKeys ( Object [ ] template ) throws Exception { Hashtable < Object , Object > hash = new Hashtable < Object , Object > ( ) ; int numMatches = 0 ; for ( int i = 0 ; i < m_Keys . size ( ) ; i ++ ) { Object [ ] current = m_Keys . get ( i ) ; if ( ! matchesTemplate ( template , current ) ) { continue ; } if ( hash . containsKey ( current [ m_KeyIndex ] ) ) { throw new Exception ( "Duplicate result received:" + DatabaseUtils . arrayToString ( current ) ) ; } numMatches ++ ; hash . put ( current [ m_KeyIndex ] , current [ m_KeyIndex ] ) ; } if ( numMatches != m_ExpectedResultsPerAverage ) { throw new Exception ( "Expected " + m_ExpectedResultsPerAverage + " results matching key \"" + DatabaseUtils . arrayToString ( template ) + "\" but got " + numMatches ) ; } }
checks whether any duplicate results ( with respect to a key template ) were received .
