V
- element typepublic class HashCoderSet<V>
extends java.lang.Object
implements java.util.Set<V>
Especially for mutable objects you should take care
of providing a useful copier with either the
HashCoder
argument in
HashCoderSet(HashCoder)
or directly with HashCoderSet(Function1)
.
Constructor and Description |
---|
HashCoderSet(Function1<V,V> copier)
Constructor for creating a hashmap with keys created from mutable objects.
|
HashCoderSet(HashCodeCalculator<? super V> calculator)
Constructor.
|
HashCoderSet(HashCodeCalculator<? super V> calculator,
Matcher<? super V,? super V> matcher)
Constructor.
|
HashCoderSet(HashCodeCalculator<? super V> calculator,
Matcher<? super V,? super V> matcher,
Function1<V,V> copier)
Constructor.
|
HashCoderSet(HashCoder<V> hashCoder)
Constructor.
|
HashCoderSet(HashCoder<V> hashCoder,
java.util.Collection<? extends V> sourceCollection)
Copy constructor.
|
HashCoderSet(HashCoder<V> hashCoder,
int initialCapacity)
Constructor.
|
HashCoderSet(HashCoder<V> hashCoder,
int initialCapacity,
float loadFactor)
Constructor.
|
HashCoderSet(HashCoder<V> hashCoder,
java.lang.Iterable<? extends V> source) |
Modifier and Type | Method and Description |
---|---|
boolean |
add(V v) |
boolean |
addAll(java.util.Collection<? extends V> c) |
boolean |
addAll(java.lang.Iterable<? extends V> it)
Add all elements of the given iterable.
|
void |
clear() |
boolean |
contains(java.lang.Object o) |
boolean |
containsAll(java.util.Collection<?> c) |
HashCoder<? super V> |
getHashCoder()
Get the hash coder used in this map.
|
boolean |
isEmpty() |
java.util.Iterator<V> |
iterator() |
boolean |
remove(java.lang.Object o) |
boolean |
removeAll(java.util.Collection<?> c) |
boolean |
retainAll(java.util.Collection<?> c) |
int |
size() |
java.lang.Object[] |
toArray() |
<T> T[] |
toArray(T[] a) |
public HashCoderSet(@NotNull HashCoder<V> hashCoder)
hashCoder
- hash coder used for hashcode calculation,
equality checks and copyingpublic HashCoderSet(@NotNull HashCoder<V> hashCoder, int initialCapacity)
hashCoder
- hash coder used for hashcode calculation,
equality checks and copyinginitialCapacity
- initial map capacitypublic HashCoderSet(@NotNull HashCoder<V> hashCoder, int initialCapacity, float loadFactor)
hashCoder
- hash coder used for hashcode calculation,
equality checks and copyinginitialCapacity
- initial map capacityloadFactor
- map load factorpublic HashCoderSet(@NotNull HashCoder<V> hashCoder, @NotNull java.util.Collection<? extends V> sourceCollection)
hashCoder
- hash coder used forsourceCollection
- source collection which's elements are copied to this setpublic HashCoderSet(@NotNull HashCoder<V> hashCoder, @NotNull java.lang.Iterable<? extends V> source)
public HashCoderSet(@NotNull HashCodeCalculator<? super V> calculator)
Objects.equals(Object, Object)
for
equality checks.calculator
- hash code calculatorpublic HashCoderSet(@NotNull HashCodeCalculator<? super V> calculator, @NotNull Matcher<? super V,? super V> matcher)
calculator
- hash code calculatormatcher
- equality checker fpr hash keyspublic HashCoderSet(@NotNull HashCodeCalculator<? super V> calculator, @NotNull Matcher<? super V,? super V> matcher, @NotNull Function1<V,V> copier)
calculator
- hash code calculatormatcher
- equality checker fpr hash keyscopier
- copier for keys, useful to decouple the keys from their basically mutable source objectspublic HashCoderSet(@NotNull Function1<V,V> copier)
Otherwise this uses the Object.hashCode()
copier
- copier for keys@NotNull public HashCoder<? super V> getHashCoder()
public int size()
public boolean isEmpty()
public boolean contains(java.lang.Object o)
@NotNull public java.lang.Object[] toArray()
public boolean add(V v)
public boolean remove(java.lang.Object o)
public boolean containsAll(@NotNull java.util.Collection<?> c)
public boolean addAll(java.util.Collection<? extends V> c)
public boolean addAll(@NotNull java.lang.Iterable<? extends V> it)
it
- iterabletrue
when this collection was changed by the additionfalse
when it was not changedpublic boolean retainAll(@NotNull java.util.Collection<?> c)
public boolean removeAll(@NotNull java.util.Collection<?> c)