/** * Add unique element to the array. * @param <T> type of the array element * @param array array * @param element element to add * * @return array, which will contain the new element. Either new array instance, if * passed array didn't contain the element, or the same array instance, if the element * is already present in the array. */ public static <T> T[] addUnique(T[] array, T element) { return addUnique(array, element, true); }
/** * Add unique element to the array. * @param <T> type of the array element * @param array array * @param element element to add * * @return array, which will contain the new element. Either new array instance, if * passed array didn't contain the element, or the same array instance, if the element * is already present in the array. */ public static <T> T[] addUnique(T[] array, T element) { return addUnique(array, element, true); }
/** * Add unique element to the array. * @param <T> type of the array element * @param array array * @param element element to add * * @return array, which will contain the new element. Either new array instance, if * passed array didn't contain the element, or the same array instance, if the element * is already present in the array. */ public static <T> T[] addUnique(T[] array, T element) { return addUnique(array, element, true); }
/** * Add unique element to the array. * @param <T> type of the array element * @param array array * @param element element to add * * @return array, which will contain the new element. Either new array instance, if * passed array didn't contain the element, or the same array instance, if the element * is already present in the array. */ public static <T> T[] addUnique(T[] array, T element) { return addUnique(array, element, true); }
/** * Add unique element to the array. * @param <T> type of the array element * @param array array * @param element element to add * * @return array, which will contain the new element. Either new array instance, if * passed array didn't contain the element, or the same array instance, if the element * is already present in the array. */ public static <T> T[] addUnique(T[] array, T element) { return addUnique(array, element, true); }
/** * Add unique element to the array. * @param <T> type of the array element * @param array array * @param element element to add * * @return array, which will contain the new element. Either new array instance, if * passed array didn't contain the element, or the same array instance, if the element * is already present in the array. */ public static <T> T[] addUnique(T[] array, T element) { return addUnique(array, element, true); }
/** * Add unique element to the array. * @param <T> type of the array element * @param array array * @param element element to add * * @return array, which will contain the new element. Either new array instance, if * passed array didn't contain the element, or the same array instance, if the element * is already present in the array. */ public static <T> T[] addUnique(T[] array, T element) { return addUnique(array, element, true); }
/** * Add unique element to the array. * @param <T> type of the array element * @param array array * @param element element to add * * @return array, which will contain the new element. Either new array instance, if * passed array didn't contain the element, or the same array instance, if the element * is already present in the array. */ public static <T> T[] addUnique(T[] array, T element) { return addUnique(array, element, true); }
/** * Add unique element to the array. * @param <T> type of the array element * @param array array * @param element element to add * * @return array, which will contain the new element. Either new array instance, if * passed array didn't contain the element, or the same array instance, if the element * is already present in the array. */ public static <T> T[] addUnique(T[] array, T element) { return addUnique(array, element, true); }
/** * Add unique element to the array. * @param <T> type of the array element * @param array array * @param element element to add * * @return array, which will contain the new element. Either new array instance, if * passed array didn't contain the element, or the same array instance, if the element * is already present in the array. */ public static <T> T[] addUnique(T[] array, T element) { return addUnique(array, element, true); }
/** * Add unique element to the array. * @param <T> type of the array element * @param array array * @param element element to add * * @return array, which will contain the new element. Either new array instance, if * passed array didn't contain the element, or the same array instance, if the element * is already present in the array. */ public static <T> T[] addUnique(T[] array, T element) { return addUnique(array, element, true); }
/** * Add unique element to the array. * @param <T> type of the array element * @param array array * @param element element to add * * @return array, which will contain the new element. Either new array instance, if * passed array didn't contain the element, or the same array instance, if the element * is already present in the array. */ public static <T> T[] addUnique(T[] array, T element) { return addUnique(array, element, true); }
/** * {@inheritDoc} */ @Override @SuppressWarnings("unchecked") public boolean add(final T element) { if (element == null) { return false; } synchronized (sync) { if (array == null) { array = (T[]) Array.newInstance(clazz, 1); array[0] = element; return true; } final T[] oldArray = array; array = ArrayUtils.addUnique(array, element, replaceElementIfEquals); return oldArray != array; } }
/** * {@inheritDoc} */ @Override @SuppressWarnings("unchecked") public boolean add(final T element) { if (element == null) { return false; } synchronized (sync) { if (array == null) { array = (T[]) Array.newInstance(clazz, 1); array[0] = element; return true; } final T[] oldArray = array; array = ArrayUtils.addUnique(array, element, replaceElementIfEquals); return oldArray != array; } }
/** * {@inheritDoc} */ @Override @SuppressWarnings("unchecked") public boolean add(final T element) { if (element == null) { return false; } synchronized (sync) { if (array == null) { array = (T[]) Array.newInstance(clazz, 1); array[0] = element; return true; } final T[] oldArray = array; array = ArrayUtils.addUnique(array, element, replaceElementIfEquals); return oldArray != array; } }
/** * {@inheritDoc} */ @Override @SuppressWarnings("unchecked") public boolean add(final T element) { if (element == null) { return false; } synchronized (sync) { if (array == null) { array = (T[]) Array.newInstance(clazz, 1); array[0] = element; return true; } final T[] oldArray = array; array = ArrayUtils.addUnique(array, element, replaceElementIfEquals); return oldArray != array; } }
/** * {@inheritDoc} */ @Override @SuppressWarnings("unchecked") public boolean add(final T element) { if (element == null) { return false; } synchronized (sync) { if (array == null) { array = (T[]) Array.newInstance(clazz, 1); array[0] = element; return true; } final T[] oldArray = array; array = ArrayUtils.addUnique(array, element, replaceElementIfEquals); return oldArray != array; } }
/** * {@inheritDoc} */ @Override @SuppressWarnings("unchecked") public boolean add(final T element) { if (element == null) { return false; } synchronized (sync) { if (array == null) { array = (T[]) Array.newInstance(clazz, 1); array[0] = element; return true; } final T[] oldArray = array; array = ArrayUtils.addUnique(array, element, replaceElementIfEquals); return oldArray != array; } }
/** * {@inheritDoc} */ @Override @SuppressWarnings("unchecked") public boolean add(final T element) { if (element == null) { return false; } synchronized (sync) { if (array == null) { array = (T[]) Array.newInstance(clazz, 1); array[0] = element; return true; } final T[] oldArray = array; array = ArrayUtils.addUnique(array, element, replaceElementIfEquals); return oldArray != array; } }
/** * {@inheritDoc} */ @Override @SuppressWarnings("unchecked") public boolean add(final T element) { if (element == null) { return false; } synchronized (sync) { if (array == null) { array = (T[]) Array.newInstance(clazz, 1); array[0] = element; return true; } final T[] oldArray = array; array = ArrayUtils.addUnique(array, element, replaceElementIfEquals); return oldArray != array; } }