I know, that there is better and easier way to write removeCats method, but I'm just wondering, why my version does not work. The error tells about noSuchElementException so it seems that comparing objects returning false in every case. I tried also with '==' but it didn't work as well. Thanks for help. public static void removeCats(Set<Object> pets, Set<Cat> cats) { //write your code here Iterator<Object> iterator = pets.iterator(); while(iterator.hasNext()) { for (Cat cat : cats) { if (iterator.next.equals(cat)) pets.remove(iterator.next()); } } }