In equals you have to define what equality really means for your object. In most cases you will have to execute equals on all of the fields, with collections you will need to check their contents if they match.
For the hashcode you can base it on hashcodes of fields you have, you just need to multiply them by different prime numbers and then execute XOR on them (in java represented by ^ symbol). Some more info on this can be found here: Combining Java hashcodes into a "master" hashcode
Here is one of the possible approaches for your case:
public class Cartoon {
private String name;
private List<String> characters;
public boolean equals(Object o){
if(o instanceof Cartoon){
Cartoon cartoonToCompare = (Cartoon) o;
return cartoonToCompare.name.equals(name) &&
cartoonToCompare.characters.containsAll(characters));
}
return false;
}
public int hashCode(){
return 991 * name.hashCode() ^ 997 * characters.size();
}
}