Package io.permazen.util
Class ConvertedSet<E,W>
java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractSet<E>
io.permazen.util.AbstractIterationSet<E>
io.permazen.util.ConvertedSet<E,W>
- Type Parameters:
E
- element type of this setW
- element type of the wrapped set
- All Implemented Interfaces:
Iterable<E>
,Collection<E>
,Set<E>
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
void
clear()
boolean
Get theConverter
associated with this instance.Get the wrappedSet
.boolean
isEmpty()
Overridden inAbstractIterationSet
to minimize the use ofAbstractIterationSet.size()
.iterator()
boolean
int
size()
Calculate size.stream()
Methods inherited from class io.permazen.util.AbstractIterationSet
buildSpliterator, equals, hashCode, spliterator, toArray, toArray
Methods inherited from class java.util.AbstractSet
removeAll
Methods inherited from class java.util.AbstractCollection
addAll, containsAll, retainAll, toString
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Collection
parallelStream, removeIf, toArray
Methods inherited from interface java.util.Set
addAll, containsAll, retainAll
-
Constructor Details
-
ConvertedSet
Constructor.- Parameters:
set
- wrapped setconverter
- element converter- Throws:
IllegalArgumentException
- if any parameter is null
-
-
Method Details
-
getWrappedSet
Get the wrappedSet
.- Returns:
- the wrapped
Set
.
-
getConverter
Get theConverter
associated with this instance.- Returns:
- associated
Converter
-
contains
- Specified by:
contains
in interfaceCollection<E>
- Specified by:
contains
in interfaceSet<E>
- Overrides:
contains
in classAbstractCollection<E>
-
iterator
-
stream
Description copied from class:AbstractIterationSet
The implementation in
AbstractIterationSet
build a stream from the results fromAbstractIterationSet.iterator()
andbuildSpliterator()
, and marks the iterator for close viaStream.onClose()
.- Specified by:
stream
in interfaceCollection<E>
- Overrides:
stream
in classAbstractIterationSet<E>
-
add
- Specified by:
add
in interfaceCollection<E>
- Specified by:
add
in interfaceSet<E>
- Overrides:
add
in classAbstractCollection<E>
-
remove
- Specified by:
remove
in interfaceCollection<E>
- Specified by:
remove
in interfaceSet<E>
- Overrides:
remove
in classAbstractCollection<E>
-
clear
public void clear()- Specified by:
clear
in interfaceCollection<E>
- Specified by:
clear
in interfaceSet<E>
- Overrides:
clear
in classAbstractCollection<E>
-
isEmpty
public boolean isEmpty()Description copied from class:AbstractIterationSet
Overridden inAbstractIterationSet
to minimize the use ofAbstractIterationSet.size()
.- Specified by:
isEmpty
in interfaceCollection<E>
- Specified by:
isEmpty
in interfaceSet<E>
- Overrides:
isEmpty
in classAbstractIterationSet<E>
-
size
public int size()Description copied from class:AbstractIterationSet
Calculate size.The implementation in
AbstractIterationSet
iterates through all of the elements.- Specified by:
size
in interfaceCollection<E>
- Specified by:
size
in interfaceSet<E>
- Overrides:
size
in classAbstractIterationSet<E>
-