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 TypeMethodDescriptionbooleanbooleanaddAll(Collection<? extends E> c) voidclear()booleanbooleancontainsAll(Collection<?> c) booleanisEmpty()iterator()max()min()static MinMaxSet<?> booleanbooleanremoveAll(Collection<?> c) booleanretainAll(Collection<?> c) intsize()Object[]toArray()<T> T[]toArray(T[] a) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArrayMethods 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:
containsAllin interfaceCollection<E>- Specified by:
containsAllin interfaceSet<E>
-
addAll
-
retainAll
-
remove
-
removeAll
-
clear
public void clear()
-