Package de.xima.fc.common.collection
Class ModCountSet<V>
- java.lang.Object
 - 
- de.xima.fc.common.collection.ModCountSet<V>
 
 
- 
- Type Parameters:
 V- Type of the elements in the set.
- All Implemented Interfaces:
 Iterable<V>,Collection<V>,Set<V>
public final class ModCountSet<V> extends Object implements Set<V>
A set that keeps track of the number of modifications made to it. The only guarantee is that the modification increases by some amount when the deque is modified. No guarantees are made about the exact amount by which the modification counter increases. This class is not thread-safe.- Since:
 - 8.2.0
 
 
- 
- 
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanadd(V v)booleanaddAll(Collection<? extends V> c)voidclear()booleancontains(Object o)booleancontainsAll(Collection<?> c)booleanequals(Object obj)voidforEach(Consumer<? super V> action)inthashCode()booleanisEmpty()Iterator<V>iterator()longmodCount()Gets the number of modifications made to this set.Counter.LongCountermodCounter()Gets the modification counter.Stream<V>parallelStream()booleanremove(Object o)booleanremoveAll(Collection<?> c)booleanremoveIf(Predicate<? super V> filter)booleanretainAll(Collection<?> c)intsize()Spliterator<V>spliterator()Stream<V>stream()Object[]toArray()<T> T[]toArray(IntFunction<T[]> generator)<T> T[]toArray(T[] a)StringtoString()static <V> ModCountSet<V>wrap(Set<V> set)Wraps a set in aModCountSetthat keeps track of the number of modifications made to it.static <V> ModCountSet<V>wrap(Set<V> set, Counter.LongCounter modCounter)Wraps a set in aModCountSetthat keeps track of the number of modifications made to it. 
 - 
 
- 
- 
Method Detail
- 
add
public boolean add(V v)
 
- 
addAll
public boolean addAll(Collection<? extends V> c)
 
- 
clear
public void clear()
 
- 
contains
public boolean contains(Object o)
 
- 
containsAll
public boolean containsAll(Collection<?> c)
- Specified by:
 containsAllin interfaceCollection<V>- Specified by:
 containsAllin interfaceSet<V>
 
- 
equals
public boolean equals(Object obj)
 
- 
hashCode
public int hashCode()
 
- 
isEmpty
public boolean isEmpty()
 
- 
modCount
public long modCount()
Gets the number of modifications made to this set.- Returns:
 - The number of modifications made to this set.
 
 
- 
modCounter
public Counter.LongCounter modCounter()
Gets the modification counter.- Returns:
 - The modification counter.
 
 
- 
parallelStream
public Stream<V> parallelStream()
- Specified by:
 parallelStreamin interfaceCollection<V>
 
- 
remove
public boolean remove(Object o)
 
- 
removeAll
public boolean removeAll(Collection<?> c)
 
- 
removeIf
public boolean removeIf(Predicate<? super V> filter)
- Specified by:
 removeIfin interfaceCollection<V>
 
- 
retainAll
public boolean retainAll(Collection<?> c)
 
- 
size
public int size()
 
- 
spliterator
public Spliterator<V> spliterator()
- Specified by:
 spliteratorin interfaceCollection<V>- Specified by:
 spliteratorin interfaceIterable<V>- Specified by:
 spliteratorin interfaceSet<V>
 
- 
stream
public Stream<V> stream()
- Specified by:
 streamin interfaceCollection<V>
 
- 
toArray
public Object[] toArray()
 
- 
toArray
public <T> T[] toArray(T[] a)
 
- 
toArray
public <T> T[] toArray(IntFunction<T[]> generator)
- Specified by:
 toArrayin interfaceCollection<V>
 
- 
wrap
public static <V> ModCountSet<V> wrap(Set<V> set)
Wraps a set in aModCountSetthat keeps track of the number of modifications made to it. May not wrap if already wrapped.- Type Parameters:
 V- Value type.- Parameters:
 set- The set to wrap.- Returns:
 - The wrapped set.
 
 
- 
wrap
public static <V> ModCountSet<V> wrap(Set<V> set, Counter.LongCounter modCounter)
Wraps a set in aModCountSetthat keeps track of the number of modifications made to it. May not wrap if already wrapped in a ModCountSet with the same modCounter.- Type Parameters:
 V- Value type.- Parameters:
 set- The set to wrap.modCounter- The modification counter to use.- Returns:
 - The wrapped set.
 
 
 - 
 
 -