Package org.apache.sis.internal.metadata
Class ExcludedSet<E>
java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractSet<E>
org.apache.sis.internal.metadata.ExcludedSet<E>
- Type Parameters:
E- the type of elements that the collection would have if it was non-empty.
- All Implemented Interfaces:
Serializable,Iterable<E>,Collection<E>,Set<E>
A unmodifiable empty set with a customized exception message thrown by the
add(Object)
method. This set is used only for mutually exclusive properties, when a collection cannot have
elements because the other property is set.- Since:
- 0.3
- Version:
- 0.3
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanUnconditionally throws aUnsupportedOperationExceptionwith a message saying which properties are mutually exclusive.booleanisEmpty()Returnstruesince this set is always empty.iterator()Returns the empty iterator.intsize()Returns0since this set is always empty.Methods inherited from class java.util.AbstractSet
equals, hashCode, removeAllMethods inherited from class java.util.AbstractCollection
addAll, clear, contains, containsAll, remove, retainAll, toArray, toArray, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, streamMethods inherited from interface java.util.Set
addAll, clear, contains, containsAll, remove, retainAll, spliterator, toArray, toArray
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDFor cross-version compatibility.- See Also:
-
name1
The name of the mutually exclusive properties. -
name2
The name of the mutually exclusive properties.
-
-
Constructor Details
-
ExcludedSet
Creates a new empty set.- Parameters:
name1- the name of the first mutually exclusive property.name2- the name of the second mutually exclusive property.
-
-
Method Details
-
isEmpty
public boolean isEmpty()Returnstruesince this set is always empty.- Specified by:
isEmptyin interfaceCollection<E>- Specified by:
isEmptyin interfaceSet<E>- Overrides:
isEmptyin classAbstractCollection<E>- Returns:
true
-
size
public int size()Returns0since this set is always empty.- Specified by:
sizein interfaceCollection<E>- Specified by:
sizein interfaceSet<E>- Specified by:
sizein classAbstractCollection<E>- Returns:
- 0
-
iterator
Returns the empty iterator. -
add
Unconditionally throws aUnsupportedOperationExceptionwith a message saying which properties are mutually exclusive.- Specified by:
addin interfaceCollection<E>- Specified by:
addin interfaceSet<E>- Overrides:
addin classAbstractCollection<E>- Parameters:
e- ignored.- Returns:
- never return.
-