java - How to write the if condition correctly -


i have question writing if condition in loop. informally, want condition work follows. have string, , want compare against list of strings. if not match of values in list, go ahead , execute body of if statement. if match 1 of values, skip body of if statement. here code (i wrote comments clear):

iterator it=row.entryset().iterator();   iterator iter=getprimarykey.entryset().iterator();  map.entry pairs=(map.entry)it.next();             if(!(pairs.getkey().equals(iter.next()))){  //this condition. i'm talking about. want key run through membres of iter. if distinct of them, go ahead , execute code in if statement.  

anyways, not know i'm doing wrong i'd interested in hearing suggestions.

it sounds me want check if string in "it" iterator present 1 of hte strings in getprimarykey.entryset(), might want check directly if contained there.

iterator it=row.entryset().iterator();   iterator iter=getprimarykey.entryset().iterator();   while(it.hasnext()){     map.entry pairs=(map.entry)it.next();     if(! getprimarykey.keyset().contains(pairs.getkey()){      } 

Comments