add(<T> element): to add only item T.
remove(Object o): you can remove the T element even if it refers to an Object link.
For instance:
T t = new T();
Set<Short> set = new HashSet<Short>();
Short number = 2;
set.add(number);
Object numberObject = number;
set.remove(numberObject)
why are you deleting another data type? we do not delete another data type, but we can delete data even if it is referenced by an object reference (as in the example).
source
share