почему не удаляет кота?
package com.javarush.task.task08.task0819;
import java.util.HashSet;
import java.util.Set;
/*
Set из котов
*/
public class Solution {
public static void main(String[] args) {
Set<Cat> cats = createCats();
//напишите тут ваш код. step 3 - пункт 3
cats.remove(1);
printCats(cats);
}
public static Set<Cat> createCats() {
//напишите тут ваш код. step 2 - пункт 2
Set<Cat> listCat = new HashSet<Cat>();
Cat one = new Cat();
one.name = "Barsik";
one.color = "black";
one.wigth = 4;
Cat two = new Cat();
two.name = "Sofa";
two.color = "wigth";
two.wigth = 6;
Cat three = new Cat();
three.name = "Murzik";
three.color = "grue";
three.wigth = 3;
listCat.add(one);
listCat.add(three);
listCat.add(two);
return listCat;
}
public static void printCats(Set<Cat> cats) {
// step 4 - пункт 4
for(Cat c:cats){
System.out.println(c);
}
}
// step 1 - пункт 1
public static class Cat {
String name;
String color;
int wigth;
}
}