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 boolean
add(S s)
boolean
add(S s, long bulk)
boolean
addAll(Collection<? extends S> collection)
Map<S,Long>
asBulk()
void
clear()
boolean
contains(Object s)
boolean
equals(Object object)
void
forEach(BiConsumer<S,Long> consumer)
long
get(S s)
int
hashCode()
boolean
isEmpty()
Iterator<S>
iterator()
long
longSize()
boolean
remove(Object s)
boolean
removeAll(Collection<?> collection)
int
size()
Spliterator<S>
spliterator()
String
toString()
int
uniqueSize()
-
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
-
size
public int size()
- Specified by:
size
in interfaceCollection<S>
- Specified by:
size
in interfaceSet<S>
- Specified by:
size
in classAbstractCollection<S>
-
uniqueSize
public int uniqueSize()
-
longSize
public long longSize()
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmpty
in interfaceCollection<S>
- Specified by:
isEmpty
in interfaceSet<S>
- Overrides:
isEmpty
in classAbstractCollection<S>
-
contains
public boolean contains(Object s)
- Specified by:
contains
in interfaceCollection<S>
- Specified by:
contains
in interfaceSet<S>
- Overrides:
contains
in classAbstractCollection<S>
-
add
public boolean add(S s)
- Specified by:
add
in interfaceCollection<S>
- Specified by:
add
in interfaceSet<S>
- Overrides:
add
in classAbstractCollection<S>
-
addAll
public boolean addAll(Collection<? extends S> collection)
- Specified by:
addAll
in interfaceCollection<S>
- Specified by:
addAll
in interfaceSet<S>
- Overrides:
addAll
in 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:
remove
in interfaceCollection<S>
- Specified by:
remove
in interfaceSet<S>
- Overrides:
remove
in classAbstractCollection<S>
-
clear
public void clear()
- Specified by:
clear
in interfaceCollection<S>
- Specified by:
clear
in interfaceSet<S>
- Overrides:
clear
in classAbstractCollection<S>
-
spliterator
public Spliterator<S> spliterator()
- Specified by:
spliterator
in interfaceCollection<S>
- Specified by:
spliterator
in interfaceIterable<S>
- Specified by:
spliterator
in interfaceSet<S>
-
removeAll
public boolean removeAll(Collection<?> collection)
- Specified by:
removeAll
in interfaceCollection<S>
- Specified by:
removeAll
in interfaceSet<S>
- Overrides:
removeAll
in classAbstractSet<S>
-
hashCode
public int hashCode()
- Specified by:
hashCode
in interfaceCollection<S>
- Specified by:
hashCode
in interfaceSet<S>
- Overrides:
hashCode
in classAbstractSet<S>
-
equals
public boolean equals(Object object)
- Specified by:
equals
in interfaceCollection<S>
- Specified by:
equals
in interfaceSet<S>
- Overrides:
equals
in classAbstractSet<S>
-
toString
public String toString()
- Overrides:
toString
in classAbstractCollection<S>
-
-