Class MinusSetView<E>
- Type Parameters:
E
- the type of elements in this set
- All Implemented Interfaces:
Iterable<E>
,Collection<E>
,Set<E>
superset - subset
.
The class assumes that all elements of the subset
are contained in
the superset
. This property must be ensured by the caller; the class
does not perform any validation checks for this condition.
This is an unmodifiable view, and all mutating operations will throw an
UnsupportedOperationException
.
- Author:
- Mathias Hofer
-
Constructor Summary
ConstructorDescriptionMinusSetView
(Set<E> superset, Set<E> subset) Constructs a view of the result of superset - subset. -
Method Summary
Methods inherited from class org.tweetyproject.arg.adf.util.AbstractUnmodifiableCollection
add, addAll, clear, remove, removeAll, removeIf, retainAll
Methods inherited from class java.util.AbstractCollection
toArray, toArray, toString
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
-
Constructor Details
-
MinusSetView
Constructs a view of the result of superset - subset.As the name suggests, it is expected that all elements of
subset
are contained insuperset
, otherwise one has to expect unreasonable results.It is up to the caller to ensure this property, this class performs no additional checks.
- Parameters:
superset
- the minuendsubset
- the subtrahend
-
-
Method Details
-
of
Returns a view of a set that excludes a specific element.This method creates a new set view that represents the given
superset
with a specified element excluded. The resulting set is a view, meaning that it does not create a copy of the superset but instead excludes the specified element dynamically.- Type Parameters:
E
- The type of elements in the set.- Parameters:
superset
- The original set from which an element is to be excluded.subtrahend
- The element to be excluded from thesuperset
.- Returns:
- A set view that represents the
superset
with thesubtrahend
excluded.
-
size
public int size()- Specified by:
size
in interfaceCollection<E>
- Specified by:
size
in interfaceSet<E>
- Specified by:
size
in classAbstractCollection<E>
-
isEmpty
public boolean isEmpty()- Specified by:
isEmpty
in interfaceCollection<E>
- Specified by:
isEmpty
in interfaceSet<E>
- Overrides:
isEmpty
in classAbstractCollection<E>
-
contains
- Specified by:
contains
in interfaceCollection<E>
- Specified by:
contains
in interfaceSet<E>
- Overrides:
contains
in classAbstractCollection<E>
-
iterator
-
containsAll
- Specified by:
containsAll
in interfaceCollection<E>
- Specified by:
containsAll
in interfaceSet<E>
- Overrides:
containsAll
in classAbstractCollection<E>
-