Package org.apache.catalina.util
Class ResourceSet<T>
java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractSet<E>
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 ResourceMap
 is not locked.- Author:
- Craig R. McClanahan
- See Also:
- 
Constructor SummaryConstructorsConstructorDescriptionConstruct 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 SummaryModifier and TypeMethodDescriptionbooleanAdd the specified element to this set if it is not already present.voidclear()Remove all of the elements from this set.booleanisLocked()booleanRemove the given element from this set if it is present.voidsetLocked(boolean locked) Set the locked state of this parameter map.Methods inherited from class java.util.HashSetclone, contains, isEmpty, iterator, size, spliterator, toArray, toArrayMethods inherited from class java.util.AbstractSetequals, hashCode, removeAllMethods inherited from class java.util.AbstractCollectionaddAll, containsAll, retainAll, toStringMethods inherited from class java.lang.Objectfinalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.CollectionparallelStream, removeIf, stream, toArray
- 
Constructor Details- 
ResourceSetpublic ResourceSet()Construct a new, empty set with the default initial capacity and load factor.
- 
ResourceSetpublic 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
 
- 
ResourceSetpublic 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 set
- loadFactor- The load factor of this set
 
- 
ResourceSetConstruct a new set with the same contents as the existing collection.- Parameters:
- coll- The collection whose contents we should copy
 
 
- 
- 
Method Details- 
isLockedpublic boolean isLocked()- Returns:
- the locked state of this parameter map.
 
- 
setLockedpublic void setLocked(boolean locked) Set the locked state of this parameter map.- Parameters:
- locked- The new locked state
 
- 
addAdd the specified element to this set if it is not already present. Returntrueif the element was added.- Specified by:
- addin interface- Collection<T>
- Specified by:
- addin interface- Set<T>
- Overrides:
- addin class- HashSet<T>
- Parameters:
- o- The object to be added
- Throws:
- IllegalStateException- if this ResourceSet is locked
 
- 
clearpublic void clear()Remove all of the elements from this set.- Specified by:
- clearin interface- Collection<T>
- Specified by:
- clearin interface- Set<T>
- Overrides:
- clearin class- HashSet<T>
- Throws:
- IllegalStateException- if this ResourceSet is locked
 
- 
removeRemove the given element from this set if it is present. Returntrueif the element was removed.- Specified by:
- removein interface- Collection<T>
- Specified by:
- removein interface- Set<T>
- Overrides:
- removein class- HashSet<T>
- Parameters:
- o- The object to be removed
- Throws:
- IllegalStateException- if this ResourceSet is locked
 
 
-