private Object nextObject() { Object obj = iter.next(); return Objects.deref(obj); }
/** * Test the equality of two object arrays. * * @param a The first array. * @param b The second array. * @return True if arrays are equal. */ public static boolean equals(final Object[] a, final Object[] b) { return equals(a, b, true); }
/** * Dereference the object at the given index. */ private Object getObject(final int index) { Object obj = list.get(index); return Objects.deref(obj); }
/** * Test the equality of an object with this. * * @param obj Object to test equality with. * @return True if object is equal. */ public boolean equals(final Object obj) { if (obj == this) return true; if (obj != null && obj.getClass() == getClass()) { CompoundKey key = (CompoundKey)obj; return Objects.equals(key.elements, elements); } return false; }
/** * 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); }
if (deep) { if (x instanceof Object[] && y instanceof Object[]) { if (! equals((Object[])x, (Object[])y, true)) return false;
/** * 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); }