Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jboss.util.collection
Class CachedCollection

    java.lang.Object
      java.util.AbstractCollection
          org.jboss.util.collection.CachedCollection

All Implemented Interfaces:
  Collection

public class CachedCollection
extends AbstractCollection

A wrapper around a `Collection` which translates added objects into `SoftObject` references, allowing the VM to garbage collect objects in the collection when memory is low.

Version:
  `$Revision: 1.3 $`
Author:
  Jason Dillon

Field Summary
`protected Collection` | `collection` Wrapped collection
`protected ReferenceQueue` | `queue` Reference queue

Constructor Summary
`CachedCollection(Collection collection)` Construct a CachedCollection.

Method Summary
`boolean` | `add(Object obj)` Add an object to the collection.
`Iterator` | `iterator()` Returns an iterator over the elements contained in this collection.
`int` | `size()` Returns the size of the collection.

Methods inherited from class java.util.AbstractCollection
`addAll, clear, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Methods inherited from interface java.util.Collection
`equals, hashCode`

Field Detail

### queue

    protected final ReferenceQueue queue

  Reference queue

### collection

    protected final Collection collection

  Wrapped collection

Constructor Detail

### CachedCollection

    public CachedCollection(Collection collection)

  Construct a CachedCollection.

Parameters:
  `collection` - Collection to wrap.

Method Detail

### iterator

    public Iterator iterator()

  Returns an iterator over the elements contained in this collection.

  Returns:
    An iterator over the elements contained in this collection.

### size

    public int size()

  Returns the size of the collection.

  Returns:
    The number of elements in the collection.

### add

    public boolean add(Object obj)

  Add an object to the collection.

  Parameters:
    `obj` - Object (or null to add to the collection.
  Returns:
    True if object was added.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2002 JBoss Group, LLC. All Rights Reserved.