/** * Returns the size of the collection. * * @return The number of elements in the collection. */ public int size() { maintain(); return collection.size(); }
/** * Returns an iterator over the elements contained in this collection. * * @return An iterator over the elements contained in this collection. */ public Iterator iterator() { maintain(); return new MyIterator(collection.iterator()); }
/** * Add an object to the collection. * * @param obj Object (or <i>null</i> to add to the collection. * @return True if object was added. */ public boolean add(final Object obj) { maintain(); SoftObject soft = SoftObject.create(obj, queue); return collection.add(soft); }