Class BulkSet<S>
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractSet<S>
-
- org.apache.tinkerpop.gremlin.process.traversal.step.util.BulkSet<S>
-
- All Implemented Interfaces:
Serializable,Iterable<S>,Collection<S>,Set<S>
public final class BulkSet<S> extends AbstractSet<S> implements Set<S>, Serializable
BulkSet is a weighted set (i.e. a multi-set). Objects are added along with a bulk counter the denotes how many times the object was added to the set. Given that count-based compression (vs. enumeration) can yield large sets, methods exist that are long-based (2^64).- Author:
- Marko A. Rodriguez (http://markorodriguez.com)
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description BulkSet()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanadd(S s)booleanadd(S s, long bulk)booleanaddAll(Collection<? extends S> collection)booleanallContainedElementsSameClass()Map<S,Long>asBulk()voidclear()booleancontains(Object s)booleanequals(Object object)voidforEach(BiConsumer<S,Long> consumer)longget(S s)Class<?>getAllContainedElementsClass()inthashCode()booleanisEmpty()Iterator<S>iterator()longlongSize()booleanremove(Object s)booleanremoveAll(Collection<?> collection)intsize()Spliterator<S>spliterator()StringtoString()intuniqueSize()-
Methods inherited from class java.util.AbstractCollection
containsAll, retainAll, toArray, toArray
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
-
Methods inherited from interface java.util.Set
containsAll, retainAll, toArray, toArray
-
-
-
-
Method Detail
-
getAllContainedElementsClass
public Class<?> getAllContainedElementsClass()
- Returns:
- the class of all contained elements/objects if it is guaranteed that all are of the same type/class (but not necessarily, i.e., they can have the same type/class, but we may return null here if it was not analysed/identified). If no common class was identified, then null is returned.
-
allContainedElementsSameClass
public boolean allContainedElementsSameClass()
- Returns:
- true if it is guaranteed that all contained elements/objects are of the same type/class and not null (but not necessarily, i.e., they can have the same type/class, but we may return false here if it was not analysed/identified)
-
size
public int size()
- Specified by:
sizein interfaceCollection<S>- Specified by:
sizein interfaceSet<S>- Specified by:
sizein classAbstractCollection<S>
-
uniqueSize
public int uniqueSize()
-
longSize
public long longSize()
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmptyin interfaceCollection<S>- Specified by:
isEmptyin interfaceSet<S>- Overrides:
isEmptyin classAbstractCollection<S>
-
contains
public boolean contains(Object s)
- Specified by:
containsin interfaceCollection<S>- Specified by:
containsin interfaceSet<S>- Overrides:
containsin classAbstractCollection<S>
-
add
public boolean add(S s)
- Specified by:
addin interfaceCollection<S>- Specified by:
addin interfaceSet<S>- Overrides:
addin classAbstractCollection<S>
-
addAll
public boolean addAll(Collection<? extends S> collection)
- Specified by:
addAllin interfaceCollection<S>- Specified by:
addAllin interfaceSet<S>- Overrides:
addAllin classAbstractCollection<S>
-
forEach
public void forEach(BiConsumer<S,Long> consumer)
-
add
public boolean add(S s, long bulk)
-
get
public long get(S s)
-
remove
public boolean remove(Object s)
- Specified by:
removein interfaceCollection<S>- Specified by:
removein interfaceSet<S>- Overrides:
removein classAbstractCollection<S>
-
clear
public void clear()
- Specified by:
clearin interfaceCollection<S>- Specified by:
clearin interfaceSet<S>- Overrides:
clearin classAbstractCollection<S>
-
spliterator
public Spliterator<S> spliterator()
- Specified by:
spliteratorin interfaceCollection<S>- Specified by:
spliteratorin interfaceIterable<S>- Specified by:
spliteratorin interfaceSet<S>
-
removeAll
public boolean removeAll(Collection<?> collection)
- Specified by:
removeAllin interfaceCollection<S>- Specified by:
removeAllin interfaceSet<S>- Overrides:
removeAllin classAbstractSet<S>
-
hashCode
public int hashCode()
- Specified by:
hashCodein interfaceCollection<S>- Specified by:
hashCodein interfaceSet<S>- Overrides:
hashCodein classAbstractSet<S>
-
equals
public boolean equals(Object object)
- Specified by:
equalsin interfaceCollection<S>- Specified by:
equalsin interfaceSet<S>- Overrides:
equalsin classAbstractSet<S>
-
toString
public String toString()
- Overrides:
toStringin classAbstractCollection<S>
-
-