
org.organicdesign.fp.collections.AbstractUnmodSet Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of Paguro Show documentation
Show all versions of Paguro Show documentation
Immutable Clojure collections and a Transformation abstraction for Java 8+, immutably, type-safely, and with good performance.
package org.organicdesign.fp.collections;
import java.util.Set;
/**
Implements equals and hashCode() methods compatible with java.util.Set (which ignores order)
to make defining unmod sets easier, especially for implementing Map.keySet() and such.
*/
public abstract class AbstractUnmodSet extends AbstractUnmodIterable implements UnmodSet {
@Override public boolean equals(Object other) {
if (this == other) { return true; }
if ( !(other instanceof Set) ) { return false; }
Set that = (Set) other;
return (size() == that.size()) &&
containsAll(that);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy