please help to sort it out.🧐
package com.codegym.task.task08.task0820;
import java.util.HashSet;
import java.util.Set;
import java.util.Iterator;
import java.util.*;
/*
Animal set
*/
public class Solution {
public static void main(String[] args) {
Set<Cat> cats = createCats();
Set<Dog> dogs = createDogs();
Set<Object> pets = join(cats, dogs);
printPets(pets);
removeCats(pets, cats);
printPets(pets);
}
public static Set<Cat> createCats() {
HashSet<Cat> cats = new HashSet<Cat>();
//write your code here
cats.add(new Cat());
cats.add(new Cat());
cats.add(new Cat());
cats.add(new Cat());
return cats;
}
public static Set<Dog> createDogs() {
//write your code here
HashSet<Dog> dogs = new HashSet<Dog>();
dogs.add(new Dog());
dogs.add(new Dog());
dogs.add(new Dog());
return dogs;
}
public static Set<Object> join(Set<Cat> cats, Set<Dog> dogs) {
//write your code here
HashSet<Object> pets = new HashSet<>();
pets.addAll(cats);
pets.addAll(dogs);
return pets;
}
public static void removeCats(Set<Object> pets, Set<Cat> cats) {
//write your code here
for(Cat s : cats){
pets.remove(s);
}
}
public static void printPets(Set<Object> pets) {
//write your code here
for(Object s: pets){
System.out.println(pets);
}
}
//write your code here
public static class Cat{};
public static class Dog{};
public static class Object{};
}