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
ConstructorsConstructorDescriptionUnionCollectionView(Collection<? extends E> c1, Collection<? extends E> c2) Constructs a newUnionCollectionViewthat represents the union of the two specified collections. -
Method Summary
Modifier and TypeMethodDescriptionbooleanbooleanisEmpty()iterator()static <E> Collection<E> of(Collection<? extends E> c, E elem) Creates a newUnionCollectionViewthat represents the union of a collection and a single element.intsize()Methods inherited from class org.tweetyproject.arg.adf.util.AbstractUnmodifiableCollection
add, addAll, clear, remove, removeAll, removeIf, retainAllMethods inherited from class java.util.AbstractCollection
containsAll, toArray, toArray, toStringMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
equals, hashCode, parallelStream, spliterator, stream, toArray
-
Constructor Details
-
UnionCollectionView
Constructs a newUnionCollectionViewthat represents the union of the two specified collections.- Parameters:
c1- the first collection to be included in the union view; must not benullc2- the second collection to be included in the union view; must not benull- Throws:
NullPointerException- if eitherc1orc2isnull
-
-
Method Details
-
of
Creates a newUnionCollectionViewthat 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 benullelem- the single element to be included in the union view; must not benull- Returns:
- a
Collection<E>representing the union ofcandelem - Throws:
NullPointerException- if eithercorelemisnull
-
iterator
-
size
public int size()- Specified by:
sizein interfaceCollection<E>- Specified by:
sizein classAbstractCollection<E>
-
isEmpty
public boolean isEmpty()- Specified by:
isEmptyin interfaceCollection<E>- Overrides:
isEmptyin classAbstractCollection<E>
-
contains
- Specified by:
containsin interfaceCollection<E>- Overrides:
containsin classAbstractCollection<E>
-