Working with Generics is definitely my weak spot, and can use some help with this.
The project is to develop a simple order/inventory system that places orders, keeps track of items and ...
package cage;
import java.util.HashSet;
import java.util.Set;
import animals.Animal;
public class Cage<T extends Animal> { //A cage for some types of animals
private Set<T> set = new HashSet<T>();
...
Hello, I am confused. According to the API a Set is "a collection that contains no duplicate elements. More formally, sets contain no pair of elements e1 and e2 such that e1.equals(e2)...". In my code below however I am able to add duplicates though equals() keeps telling me that the Objects in questions (p1 and p2) are equal. Due to my ...