Package de.cxp.ocs.util
Class MinMaxSet<E>
java.lang.Object
de.cxp.ocs.util.MinMaxSet<E>
- All Implemented Interfaces:
Iterable<E>
,Collection<E>
,Set<E>
A set that only returns the min and the max value (based on natural ordering)
of all added values.
If only one value is added, it is the min and the max value, however if
returned as iterator or array, the set will only contain that one value.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
boolean
addAll
(Collection<? extends E> c) void
clear()
boolean
boolean
containsAll
(Collection<?> c) boolean
isEmpty()
iterator()
max()
min()
static MinMaxSet
<?> boolean
boolean
removeAll
(Collection<?> c) boolean
retainAll
(Collection<?> c) int
size()
Object[]
toArray()
<T> T[]
toArray
(T[] a) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
Methods inherited from interface java.util.Set
equals, hashCode, spliterator
-
Constructor Details
-
MinMaxSet
-
MinMaxSet
-
-
Method Details
-
of
-
size
public int size() -
isEmpty
public boolean isEmpty() -
contains
-
min
-
max
-
iterator
-
toArray
-
toArray
public <T> T[] toArray(T[] a) -
add
-
containsAll
- Specified by:
containsAll
in interfaceCollection<E>
- Specified by:
containsAll
in interfaceSet<E>
-
addAll
-
retainAll
-
remove
-
removeAll
-
clear
public void clear()
-