Modified from java.util.WeakHashMap.WeakKey. @version $Revision: 2787 $ @author Jason Dillon
121122123124125126127128
* @param obj Element to be inserted. */ public void add(final int index, final Object obj) { maintain(); SoftObject soft = SoftObject.create(obj, queue); list.add(index, soft); }
144145146147148149150151152153154
/** * Maintains the collection by removing garbage collected objects. */ private void maintain() { SoftObject obj; int count = 0; while ((obj = (SoftObject)queue.poll()) != null) { count++; list.remove(obj);
838485868788899091
* @return True if object was added. */ public boolean add(final Object obj) { maintain(); SoftObject soft = SoftObject.create(obj, queue); return collection.add(soft); }
9293949596979899100101102
/** * Maintains the collection by removing garbage collected objects. */ private void maintain() { SoftObject obj; int count = 0; while ((obj = (SoftObject)queue.poll()) != null) { count++; collection.remove(obj);
103104105106107108109110111112
* @return The previous element at the given index. */ public Object set(final int index, final Object obj) { maintain(); SoftObject soft = SoftObject.create(obj, queue); soft = (SoftObject)list.set(index, soft); return Objects.deref(soft); }
44454647484950515253
/* */ /* */ public Object set(int index, Object obj) /* */ { /* 106 */ maintain(); /* */ /* 108 */ SoftObject soft = SoftObject.create(obj, this.queue); /* 109 */ soft = (SoftObject)this.list.set(index, soft); /* */ /* 111 */ return Objects.deref(soft); /* */ }
5455565758596061
/* */ /* */ public void add(int index, Object obj) /* */ { /* 124 */ maintain(); /* */ /* 126 */ SoftObject soft = SoftObject.create(obj, this.queue); /* 127 */ this.list.add(index, soft); /* */ }
6970717273747576777879
/* */ } /* */ /* */ private void maintain() /* */ { /* 150 */ int count = 0; /* */ SoftObject obj; /* 152 */ while ((obj = (SoftObject)this.queue.poll()) != null) { /* 153 */ count++; /* 154 */ this.list.remove(obj); /* */ } /* */
323334353637383940
/* */ /* */ public boolean add(Object obj) /* */ { /* 86 */ maintain(); /* */ /* 88 */ SoftObject soft = SoftObject.create(obj, this.queue); /* */ /* 90 */ return this.collection.add(soft); /* */ }
4041424344454647484950
/* */ } /* */ /* */ private void maintain() /* */ { /* 98 */ int count = 0; /* */ SoftObject obj; /* 100 */ while ((obj = (SoftObject)this.queue.poll()) != null) { /* 101 */ count++; /* 102 */ this.collection.remove(obj); /* */ } /* */