Package one.microstream.collections.lazy
Class LazyHashSet<T>
java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractSet<T>
one.microstream.collections.lazy.LazyHashSet<T>
- Type Parameters:
T
- Type of contained elements
- All Implemented Interfaces:
Iterable<T>
,Collection<T>
,Set<T>
public final class LazyHashSet<T> extends AbstractSet<T>
Implementation of the
Set
interface, backed by a LazyHashMap
-
Constructor Summary
Constructors Constructor Description LazyHashSet()
Create a new LazyHashSet instance with default maximal segment size.LazyHashSet(int maxSegmentSize)
Creates a newLazyHashSet
with a custom segment size.LazyHashSet(int maxSegmentSize, LazySegmentUnloader lazySegmentUnloader)
Creates a newLazyHashSet
with a maximum desired segment size. -
Method Summary
Modifier and Type Method Description boolean
add(T e)
void
clear()
boolean
contains(Object o)
int
getMaxSegmentSize()
Returns the maximum segment size of thisLazyArrayList
.long
getSegmentCount()
Returns the current number of internal segments.boolean
isEmpty()
Iterator<T>
iterator()
boolean
remove(Object o)
Iterable<? extends LazyHashMap.Segment<?>>
segments()
Returns an Iterable over the Segment in this list.int
size()
Spliterator<T>
spliterator()
String
toString()
Methods inherited from class java.util.AbstractCollection
addAll, containsAll, retainAll, toArray, toArray
-
Constructor Details
-
LazyHashSet
public LazyHashSet()Create a new LazyHashSet instance with default maximal segment size. -
LazyHashSet
public LazyHashSet(int maxSegmentSize)Creates a newLazyHashSet
with a custom segment size. The desired maximum segment size is not a hard limit. The map may exceed that limit.- Parameters:
maxSegmentSize
- maximum desired segment size, must be non negative.
-
LazyHashSet
Creates a newLazyHashSet
with a maximum desired segment size. The desired maximum segment size is not a hard limit. The map may exceed that limit.- Parameters:
maxSegmentSize
- maximum desired segment size, must be non negative.lazySegmentUnloader
- LazySegmentUnloader instance
-
-
Method Details
-
getSegmentCount
public long getSegmentCount()Returns the current number of internal segments.- Returns:
- the current number of internal segments.
-
segments
Returns an Iterable over the Segment in this list.- Returns:
- an Iterable over the Segment in this list
-
getMaxSegmentSize
public int getMaxSegmentSize()Returns the maximum segment size of thisLazyArrayList
.- Returns:
- the maximum segment size of this
LazyArrayList
-
iterator
-
size
public int size()- Specified by:
size
in interfaceCollection<T>
- Specified by:
size
in interfaceSet<T>
- Specified by:
size
in classAbstractCollection<T>
-
isEmpty
public boolean isEmpty()- Specified by:
isEmpty
in interfaceCollection<T>
- Specified by:
isEmpty
in interfaceSet<T>
- Overrides:
isEmpty
in classAbstractCollection<T>
-
contains
- Specified by:
contains
in interfaceCollection<T>
- Specified by:
contains
in interfaceSet<T>
- Overrides:
contains
in classAbstractCollection<T>
-
add
- Specified by:
add
in interfaceCollection<T>
- Specified by:
add
in interfaceSet<T>
- Overrides:
add
in classAbstractCollection<T>
-
remove
- Specified by:
remove
in interfaceCollection<T>
- Specified by:
remove
in interfaceSet<T>
- Overrides:
remove
in classAbstractCollection<T>
-
clear
public void clear()- Specified by:
clear
in interfaceCollection<T>
- Specified by:
clear
in interfaceSet<T>
- Overrides:
clear
in classAbstractCollection<T>
-
spliterator
-
toString
- Overrides:
toString
in classAbstractCollection<T>
-