Package org.tweetyproject.arg.adf.util
Class UnionCollectionView<E>
java.lang.Object
java.util.AbstractCollection<E>
org.tweetyproject.arg.adf.util.AbstractUnmodifiableCollection<E>
org.tweetyproject.arg.adf.util.UnionCollectionView<E>
- Type Parameters:
E
- type
- All Implemented Interfaces:
Iterable<E>
,Collection<E>
UnionCollectionView class
- Author:
- Mathias Hofer
-
Constructor Summary
ConstructorDescriptionUnionCollectionView
(Collection<? extends E> c1, Collection<? extends E> c2) Constructs a newUnionCollectionView
that represents the union of the two specified collections. -
Method Summary
Modifier and TypeMethodDescriptionboolean
boolean
isEmpty()
iterator()
static <E> Collection
<E> of
(Collection<? extends E> c, E elem) Creates a newUnionCollectionView
that represents the union of a collection and a single element.int
size()
Methods inherited from class org.tweetyproject.arg.adf.util.AbstractUnmodifiableCollection
add, addAll, clear, remove, removeAll, removeIf, retainAll
Methods inherited from class java.util.AbstractCollection
containsAll, 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
equals, hashCode, parallelStream, spliterator, stream, toArray
-
Constructor Details
-
UnionCollectionView
Constructs a newUnionCollectionView
that represents the union of the two specified collections.- Parameters:
c1
- the first collection to be included in the union view; must not benull
c2
- the second collection to be included in the union view; must not benull
- Throws:
NullPointerException
- if eitherc1
orc2
isnull
-
-
Method Details
-
of
Creates a newUnionCollectionView
that represents the union of a collection and a single element.This method provides a convenient way to create a union view when you have a collection and want to add a single additional element to it without modifying the original collection.
- Type Parameters:
E
- the type of elements in the collection- Parameters:
c
- the collection to be included in the union view; must not benull
elem
- the single element to be included in the union view; must not benull
- Returns:
- a
Collection<E>
representing the union ofc
andelem
- Throws:
NullPointerException
- if eitherc
orelem
isnull
-
iterator
-
size
public int size()- Specified by:
size
in interfaceCollection<E>
- Specified by:
size
in classAbstractCollection<E>
-
isEmpty
public boolean isEmpty()- Specified by:
isEmpty
in interfaceCollection<E>
- Overrides:
isEmpty
in classAbstractCollection<E>
-
contains
- Specified by:
contains
in interfaceCollection<E>
- Overrides:
contains
in classAbstractCollection<E>
-