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 TypeMethodDescriptionboolean
Unconditionally throws aUnsupportedOperationException
with a message saying which properties are mutually exclusive.boolean
isEmpty()
Returnstrue
since this set is always empty.iterator()
Returns the empty iterator.int
size()
Returns0
since this set is always empty.Methods inherited from class java.util.AbstractSet
equals, hashCode, removeAll
Methods inherited from class java.util.AbstractCollection
addAll, clear, contains, containsAll, remove, retainAll, toArray, toArray, toString
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
Methods 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()Returnstrue
since this set is always empty.- Specified by:
isEmpty
in interfaceCollection<E>
- Specified by:
isEmpty
in interfaceSet<E>
- Overrides:
isEmpty
in classAbstractCollection<E>
- Returns:
true
-
size
public int size()Returns0
since this set is always empty.- Specified by:
size
in interfaceCollection<E>
- Specified by:
size
in interfaceSet<E>
- Specified by:
size
in classAbstractCollection<E>
- Returns:
- 0
-
iterator
Returns the empty iterator. -
add
Unconditionally throws aUnsupportedOperationException
with a message saying which properties are mutually exclusive.- Specified by:
add
in interfaceCollection<E>
- Specified by:
add
in interfaceSet<E>
- Overrides:
add
in classAbstractCollection<E>
- Parameters:
e
- ignored.- Returns:
- never return.
-