/** * Construct a new instance. * * @param updater the field updater * @param componentType the component class * @param <T> the type which contains the target field * @param <V> the array value type * @return the new instance */ public static <T, V> AtomicArray<T, V> create(AtomicReferenceFieldUpdater<T, V[]> updater, Class<V> componentType) { Assert.checkNotNullParam("updater", updater); Assert.checkNotNullParam("componentType", componentType); return new AtomicArray<>(updater, (V[]) Array.newInstance(componentType, 0)); }
/** * Construct a new instance. * * @param updater the field updater * @param creator the array creator * @param <T> the type which contains the target field * @param <V> the array value type * @return the new instance * @deprecated Use {@link #create(AtomicReferenceFieldUpdater, Object[])} or {@link #create(AtomicReferenceFieldUpdater, Class)} instead. */ @Deprecated public static <T, V> AtomicArray<T, V> create(AtomicReferenceFieldUpdater<T, V[]> updater, Creator<V> creator) { Assert.checkNotNullParam("updater", updater); Assert.checkNotNullParam("creator", creator); return new AtomicArray<>(updater, creator.create(0)); }
/** * Construct a new instance. * * @param updater the field updater * @param emptyArray an empty array of the target type * @param <T> the type which contains the target field * @param <V> the array value type * @return the new instance */ public static <T, V> AtomicArray<T, V> create(AtomicReferenceFieldUpdater<T, V[]> updater, V[] emptyArray) { Assert.checkNotNullParam("updater", updater); Assert.checkNotNullParam("emptyArray", emptyArray); if (emptyArray.length > 0) { throw Messages.msg.arrayNotEmpty(); } return new AtomicArray<>(updater, emptyArray); }
/** * Construct a new instance. * * @param updater the field updater * @param componentType the component class * @param <T> the type which contains the target field * @param <V> the array value type * @return the new instance */ public static <T, V> AtomicArray<T, V> create(AtomicReferenceFieldUpdater<T, V[]> updater, Class<V> componentType) { Assert.checkNotNullParam("updater", updater); Assert.checkNotNullParam("componentType", componentType); return new AtomicArray<>(updater, (V[]) Array.newInstance(componentType, 0)); }
/** * Construct a new instance. * * @param updater the field updater * @param componentType the component class * @param <T> the type which contains the target field * @param <V> the array value type * @return the new instance */ public static <T, V> AtomicArray<T, V> create(AtomicReferenceFieldUpdater<T, V[]> updater, Class<V> componentType) { Assert.checkNotNullParam("updater", updater); Assert.checkNotNullParam("componentType", componentType); return new AtomicArray<>(updater, (V[]) Array.newInstance(componentType, 0)); }
/** * Construct a new instance. * * @param updater the field updater * @param creator the array creator * @param <T> the type which contains the target field * @param <V> the array value type * @return the new instance * @deprecated Use {@link #create(AtomicReferenceFieldUpdater, Object[])} or {@link #create(AtomicReferenceFieldUpdater, Class)} instead. */ @Deprecated public static <T, V> AtomicArray<T, V> create(AtomicReferenceFieldUpdater<T, V[]> updater, Creator<V> creator) { Assert.checkNotNullParam("updater", updater); Assert.checkNotNullParam("creator", creator); return new AtomicArray<>(updater, creator.create(0)); }
/** * Construct a new instance. * * @param updater the field updater * @param creator the array creator * @param <T> the type which contains the target field * @param <V> the array value type * @return the new instance * @deprecated Use {@link #create(AtomicReferenceFieldUpdater, Object[])} or {@link #create(AtomicReferenceFieldUpdater, Class)} instead. */ @Deprecated public static <T, V> AtomicArray<T, V> create(AtomicReferenceFieldUpdater<T, V[]> updater, Creator<V> creator) { Assert.checkNotNullParam("updater", updater); Assert.checkNotNullParam("creator", creator); return new AtomicArray<>(updater, creator.create(0)); }
/** * Construct a new instance. * * @param updater the field updater * @param emptyArray an empty array of the target type * @param <T> the type which contains the target field * @param <V> the array value type * @return the new instance */ public static <T, V> AtomicArray<T, V> create(AtomicReferenceFieldUpdater<T, V[]> updater, V[] emptyArray) { Assert.checkNotNullParam("updater", updater); Assert.checkNotNullParam("emptyArray", emptyArray); if (emptyArray.length > 0) { throw Messages.msg.arrayNotEmpty(); } return new AtomicArray<>(updater, emptyArray); }
/** * Construct a new instance. * * @param updater the field updater * @param emptyArray an empty array of the target type * @param <T> the type which contains the target field * @param <V> the array value type * @return the new instance */ public static <T, V> AtomicArray<T, V> create(AtomicReferenceFieldUpdater<T, V[]> updater, V[] emptyArray) { Assert.checkNotNullParam("updater", updater); Assert.checkNotNullParam("emptyArray", emptyArray); if (emptyArray.length > 0) { throw Messages.msg.arrayNotEmpty(); } return new AtomicArray<>(updater, emptyArray); }