/** * Checks if another object is equal to this set. * * @param o the object to check for equality with * @return true if o is an instance of WeightedSet and the two encapsulated Maps are equal, false otherwise */ public boolean equals(Object o) { if (!(o instanceof WeightedSet)) return false; return (super.equals(o) && map.equals(((WeightedSet<K>)o).map)); }