private Object nextObject() { Object obj = iter.next(); return Objects.deref(obj); }
/** * Dereference the object at the given index. */ private Object getObject(final int index) { Object obj = list.get(index); return Objects.deref(obj); }
/** * Dereference an object * * @param <T> the expected type * @param obj the object or reference * @param expected the expected type * @return the object or null */ public static <T> T deref(final Object obj, Class<T> expected) { Object result = deref(obj); if (result == null) return null; return expected.cast(result); }
/** * Removes the element at the specified position in this list (optional * operation). Shifts any subsequent elements to the left (subtracts one * from their indices). Returns the element that was removed from the list. * * @param index The index of the element to remove. * @return The element previously at the specified position. */ public Object remove(final int index) { maintain(); Object obj = list.remove(index); return Objects.deref(obj); }
/** * Replaces the element at the specified position in this list with the * specified element. * * @param index Index of element to replace. * @param obj Element to be stored at the specified postion. * @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); }