if(poslc.getAll() != null){ tmpMap = poslc.getAll(); //get the map from the listcontroller it = tmpMap.keySet().iterator(); //assumes the iterator while(it.hasNext()){ tmpPos = (Position)it.next(); //!!!! exception occurs !!!!! if(tmpPos.getPosition().equals(tfNewPosition.getText())) //compares throw new myException("Already exists!"); //item already exists }