public class GroupedSet<GroupingValueType,GroupedKeyType,WholeKeyType>
extends java.lang.Object
implements java.util.Set<WholeKeyType>
Set
implementation where each contained value is produced by combining together a grouping value
and some other (key) object. The way of combining together these two values is specified by the closure passed to the
constructor. Only a select few Set
operations are supported. This collection is unmodifiable.Modifier and Type | Field and Description |
---|---|
protected GroupingValueType |
group |
protected java.util.function.BiFunction<GroupingValueType,GroupedKeyType,WholeKeyType> |
valueFunc |
protected java.util.Collection<GroupedKeyType> |
values |
Constructor and Description |
---|
GroupedSet(GroupingValueType group,
java.util.Collection<GroupedKeyType> values,
java.util.function.BiFunction<GroupingValueType,GroupedKeyType,WholeKeyType> valueFunc) |
Modifier and Type | Method and Description |
---|---|
boolean |
add(WholeKeyType tuple) |
boolean |
addAll(java.util.Collection<? extends WholeKeyType> coll) |
void |
clear() |
boolean |
contains(java.lang.Object obj) |
boolean |
containsAll(java.util.Collection<?> c) |
boolean |
isEmpty() |
java.util.Iterator<WholeKeyType> |
iterator() |
boolean |
remove(java.lang.Object obj) |
boolean |
removeAll(java.util.Collection<?> coll) |
boolean |
retainAll(java.util.Collection<?> coll) |
int |
size() |
java.lang.Object[] |
toArray() |
<T> T[] |
toArray(T[] arr) |
protected final GroupingValueType group
protected final java.util.Collection<GroupedKeyType> values
protected final java.util.function.BiFunction<GroupingValueType,GroupedKeyType,WholeKeyType> valueFunc
public GroupedSet(GroupingValueType group, java.util.Collection<GroupedKeyType> values, java.util.function.BiFunction<GroupingValueType,GroupedKeyType,WholeKeyType> valueFunc)
public int size()
size
in interface java.util.Collection<WholeKeyType>
size
in interface java.util.Set<WholeKeyType>
public boolean isEmpty()
isEmpty
in interface java.util.Collection<WholeKeyType>
isEmpty
in interface java.util.Set<WholeKeyType>
public boolean contains(java.lang.Object obj)
contains
in interface java.util.Collection<WholeKeyType>
contains
in interface java.util.Set<WholeKeyType>
public java.util.Iterator<WholeKeyType> iterator()
iterator
in interface java.lang.Iterable<WholeKeyType>
iterator
in interface java.util.Collection<WholeKeyType>
iterator
in interface java.util.Set<WholeKeyType>
public java.lang.Object[] toArray()
toArray
in interface java.util.Collection<WholeKeyType>
toArray
in interface java.util.Set<WholeKeyType>
public <T> T[] toArray(T[] arr)
toArray
in interface java.util.Collection<WholeKeyType>
toArray
in interface java.util.Set<WholeKeyType>
public boolean add(WholeKeyType tuple)
add
in interface java.util.Collection<WholeKeyType>
add
in interface java.util.Set<WholeKeyType>
public boolean remove(java.lang.Object obj)
remove
in interface java.util.Collection<WholeKeyType>
remove
in interface java.util.Set<WholeKeyType>
public boolean containsAll(java.util.Collection<?> c)
containsAll
in interface java.util.Collection<WholeKeyType>
containsAll
in interface java.util.Set<WholeKeyType>
public boolean addAll(java.util.Collection<? extends WholeKeyType> coll)
addAll
in interface java.util.Collection<WholeKeyType>
addAll
in interface java.util.Set<WholeKeyType>
public boolean retainAll(java.util.Collection<?> coll)
retainAll
in interface java.util.Collection<WholeKeyType>
retainAll
in interface java.util.Set<WholeKeyType>
public boolean removeAll(java.util.Collection<?> coll)
removeAll
in interface java.util.Collection<WholeKeyType>
removeAll
in interface java.util.Set<WholeKeyType>
public void clear()
clear
in interface java.util.Collection<WholeKeyType>
clear
in interface java.util.Set<WholeKeyType>