Class ResourceSet<T>
java.lang.Object
java.util.AbstractCollection<T>
java.util.AbstractSet<T>
java.util.HashSet<T>
org.apache.catalina.util.ResourceSet<T>
- Type Parameters:
T- The type of elements in the Set
- All Implemented Interfaces:
Serializable, Cloneable, Iterable<T>, Collection<T>, Set<T>
Extended implementation of HashSet that includes a
locked property. This class can be
used to safely expose resource path sets to user classes without having to clone them in order to avoid
modifications. When first created, a ResourceSet is not locked.- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionConstruct a new, empty set with the default initial capacity and load factor.ResourceSet(int initialCapacity) Construct a new, empty set with the specified initial capacity and default load factor.ResourceSet(int initialCapacity, float loadFactor) Construct a new, empty set with the specified initial capacity and load factor.ResourceSet(Collection<T> coll) Construct a new set with the same contents as the existing collection. -
Method Summary
Modifier and TypeMethodDescriptionbooleanbooleanaddAll(Collection<? extends T> c) voidclear()booleanisLocked()Return the locked state of this parameter map.iterator()booleanbooleanremoveAll(Collection<?> c) booleanbooleanretainAll(Collection<?> c) voidsetLocked(boolean locked) Set the locked state of this parameter map.Methods inherited from class HashSet
clone, contains, isEmpty, newHashSet, size, spliterator, toArray, toArrayMethods inherited from class AbstractSet
equals, hashCodeMethods inherited from class AbstractCollection
containsAll, toStringMethods inherited from interface Collection
parallelStream, stream, toArrayMethods inherited from interface Set
containsAll, equals, hashCode
-
Constructor Details
-
ResourceSet
public ResourceSet()Construct a new, empty set with the default initial capacity and load factor. -
ResourceSet
public ResourceSet(int initialCapacity) Construct a new, empty set with the specified initial capacity and default load factor.- Parameters:
initialCapacity- The initial capacity of this set
-
ResourceSet
public ResourceSet(int initialCapacity, float loadFactor) Construct a new, empty set with the specified initial capacity and load factor.- Parameters:
initialCapacity- The initial capacity of this setloadFactor- The load factor of this set
-
ResourceSet
Construct a new set with the same contents as the existing collection.- Parameters:
coll- The collection whose contents we should copy
-
-
Method Details
-
isLocked
public boolean isLocked()Return the locked state of this parameter map.- Returns:
- the locked state of this parameter map
-
setLocked
public void setLocked(boolean locked) Set the locked state of this parameter map.- Parameters:
locked- The new locked state
-
add
-
addAll
- Specified by:
addAllin interfaceCollection<T>- Specified by:
addAllin interfaceSet<T>- Overrides:
addAllin classAbstractCollection<T>- Throws:
IllegalStateException- if this set is currently locked
-
clear
public void clear()- Specified by:
clearin interfaceCollection<T>- Specified by:
clearin interfaceSet<T>- Overrides:
clearin classHashSet<T>- Throws:
IllegalStateException- if this set is currently locked
-
remove
-
removeAll
- Specified by:
removeAllin interfaceCollection<T>- Specified by:
removeAllin interfaceSet<T>- Overrides:
removeAllin classAbstractSet<T>- Throws:
IllegalStateException- if this set is currently locked
-
retainAll
- Specified by:
retainAllin interfaceCollection<T>- Specified by:
retainAllin interfaceSet<T>- Overrides:
retainAllin classAbstractCollection<T>- Throws:
IllegalStateException- if this set is currently locked
-
removeIf
- Throws:
IllegalStateException- if this set is currently locked
-
iterator
-