Package org.apache.jackrabbit.util
Class WeakIdentityCollection
- java.lang.Object
 - 
- org.apache.jackrabbit.util.WeakIdentityCollection
 
 
- 
- All Implemented Interfaces:
 java.lang.Iterable,java.util.Collection
public class WeakIdentityCollection extends java.lang.Object implements java.util.CollectionWeakIdentityCollectionimplements a Collection with weak values. Equality of elements is tested using the == operator.This collection does not hide the fact that the garbage collector will remove a mapping at some point in time. Thus, the
Iteratorreturned by this collection might returnnullvalues. The same applies to the methodtoArray()in both its variants. 
- 
- 
Constructor Summary
Constructors Constructor Description WeakIdentityCollection(int initialCapacity)Creates a new WeakIdentityCollection. 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanadd(java.lang.Object o)Adds objectoto this collection.booleanaddAll(java.util.Collection c)voidclear()Releases all references held by this collection.booleancontains(java.lang.Object o)Returnstrueif this collection containso.booleancontainsAll(java.util.Collection c)booleanisEmpty()Returnstrueif this collection is empty.java.util.Iteratoriterator()Returns anIteratorover the elements of this collection.booleanremove(java.lang.Object o)Removes the objectofrom this collection if it is present.booleanremoveAll(java.util.Collection c)booleanretainAll(java.util.Collection c)intsize()Returns the current size of this collection.java.lang.Object[]toArray()Returns an array containing all of the elements in this collection.java.lang.Object[]toArray(java.lang.Object[] a)The returned array may containnullelements!- 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait 
 - 
 
 - 
 
- 
- 
Method Detail
- 
size
public int size()
Returns the current size of this collection.- Specified by:
 sizein interfacejava.util.Collection- Returns:
 - the current size of this collection.
 
 
- 
isEmpty
public boolean isEmpty()
Returnstrueif this collection is empty.- Specified by:
 isEmptyin interfacejava.util.Collection- Returns:
 trueif this collection is empty.
 
- 
clear
public void clear()
Releases all references held by this collection.- Specified by:
 clearin interfacejava.util.Collection
 
- 
add
public boolean add(java.lang.Object o)
Adds objectoto this collection.- Specified by:
 addin interfacejava.util.Collection- Parameters:
 o- the object to add.- Returns:
 - always 
trueas this collection allows duplicates. - Throws:
 java.lang.NullPointerException- ifoisnull.
 
- 
contains
public boolean contains(java.lang.Object o)
Returnstrueif this collection containso.- Specified by:
 containsin interfacejava.util.Collection- Parameters:
 o- element whose presence in this collection is to be tested.- Returns:
 trueif this collection contains the specified element
 
- 
remove
public boolean remove(java.lang.Object o)
Removes the objectofrom this collection if it is present.- Specified by:
 removein interfacejava.util.Collection- Parameters:
 o- the object to remove.- Returns:
 trueif this collection changed as a result of the call.
 
- 
addAll
public boolean addAll(java.util.Collection c)
- Specified by:
 addAllin interfacejava.util.Collection- Throws:
 java.lang.UnsupportedOperationException- always.
 
- 
containsAll
public boolean containsAll(java.util.Collection c)
- Specified by:
 containsAllin interfacejava.util.Collection- Throws:
 java.lang.UnsupportedOperationException- always.
 
- 
removeAll
public boolean removeAll(java.util.Collection c)
- Specified by:
 removeAllin interfacejava.util.Collection- Throws:
 java.lang.UnsupportedOperationException- always.
 
- 
retainAll
public boolean retainAll(java.util.Collection c)
- Specified by:
 retainAllin interfacejava.util.Collection- Throws:
 java.lang.UnsupportedOperationException- always.
 
- 
iterator
public java.util.Iterator iterator()
Returns anIteratorover the elements of this collection. The returned iterator is not fail-fast. That is, it does not throw aConcurrentModificationExceptionif this collection is modified while iterating over the collection.- Specified by:
 iteratorin interfacejava.util.Collection- Specified by:
 iteratorin interfacejava.lang.Iterable- Returns:
 - an 
Iteratorover the elements of this collection. 
 
- 
toArray
public java.lang.Object[] toArray()
Returns an array containing all of the elements in this collection. The returned array may containnullelements!- Specified by:
 toArrayin interfacejava.util.Collection- Returns:
 - an array containing all of the elements in this collection.
 
 
- 
toArray
public java.lang.Object[] toArray(java.lang.Object[] a)
The returned array may containnullelements!- Specified by:
 toArrayin interfacejava.util.Collection
 
 - 
 
 -