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:
java.io.Serializable
,java.lang.Cloneable
,java.lang.Iterable<T>
,java.util.Collection<T>
,java.util.Set<T>
public final class ResourceSet<T> extends java.util.HashSet<T>
Extended implementation of HashSet that includes alocked
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, aResourceMap
is not locked.- Author:
- Craig R. McClanahan
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ResourceSet()
Construct 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(java.util.Collection<T> coll)
Construct a new set with the same contents as the existing collection.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
add(T o)
Add the specified element to this set if it is not already present.void
clear()
Remove all of the elements from this set.boolean
isLocked()
boolean
remove(java.lang.Object o)
Remove the given element from this set if it is present.void
setLocked(boolean locked)
Set the locked state of this parameter map.-
Methods inherited from class java.util.HashSet
clone, contains, isEmpty, iterator, size, spliterator
-
Methods inherited from class java.util.AbstractCollection
addAll, containsAll, retainAll, toArray, toArray, toString
-
-
-
-
Constructor Detail
-
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
public ResourceSet(java.util.Collection<T> coll)
Construct a new set with the same contents as the existing collection.- Parameters:
coll
- The collection whose contents we should copy
-
-
Method Detail
-
isLocked
public boolean isLocked()
- 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
public boolean add(T o)
Add the specified element to this set if it is not already present. Returntrue
if the element was added.
-
clear
public void clear()
Remove all of the elements from this set.
-
remove
public boolean remove(java.lang.Object o)
Remove the given element from this set if it is present. Returntrue
if the element was removed.
-
-