/** * {@inheritDoc} */ @Override public boolean containsAll(Collection<?> collection) { if (collection.isEmpty()) { return true; } final Object[] localArray = array; for (Object element : collection) { if (ArrayUtils.indexOf(localArray, element) == -1) { return false; } } return true; }
/** * {@inheritDoc} */ @Override public boolean containsAll(Collection<?> collection) { if (collection.isEmpty()) { return true; } final Object[] localArray = array; for (Object element : collection) { if (ArrayUtils.indexOf(localArray, element) == -1) { return false; } } return true; }
/** * {@inheritDoc} */ @Override public boolean containsAll(Collection<?> collection) { if (collection.isEmpty()) { return true; } final Object[] localArray = array; for (Object element : collection) { if (ArrayUtils.indexOf(localArray, element) == -1) { return false; } } return true; }
/** * {@inheritDoc} */ @Override public boolean containsAll(Collection<?> collection) { if (collection.isEmpty()) { return true; } final Object[] localArray = array; for (Object element : collection) { if (ArrayUtils.indexOf(localArray, element) == -1) { return false; } } return true; }
/** * {@inheritDoc} */ @Override public boolean containsAll(Collection<?> collection) { if (collection.isEmpty()) { return true; } final Object[] localArray = array; for (Object element : collection) { if (ArrayUtils.indexOf(localArray, element) == -1) { return false; } } return true; }
/** * {@inheritDoc} */ @Override public boolean containsAll(Collection<?> collection) { if (collection.isEmpty()) { return true; } final Object[] localArray = array; for (Object element : collection) { if (ArrayUtils.indexOf(localArray, element) == -1) { return false; } } return true; }
/** * {@inheritDoc} */ @Override public boolean containsAll(Collection<?> collection) { if (collection.isEmpty()) { return true; } final Object[] localArray = array; for (Object element : collection) { if (ArrayUtils.indexOf(localArray, element) == -1) { return false; } } return true; }
/** * {@inheritDoc} */ @Override public boolean containsAll(Collection<?> collection) { if (collection.isEmpty()) { return true; } final Object[] localArray = array; for (Object element : collection) { if (ArrayUtils.indexOf(localArray, element) == -1) { return false; } } return true; }
/** * {@inheritDoc} */ @Override public boolean containsAll(Collection<?> collection) { if (collection.isEmpty()) { return true; } final Object[] localArray = array; for (Object element : collection) { if (ArrayUtils.indexOf(localArray, element) == -1) { return false; } } return true; }
/** * {@inheritDoc} */ @Override public boolean containsAll(Collection<?> collection) { if (collection.isEmpty()) { return true; } final Object[] localArray = array; for (Object element : collection) { if (ArrayUtils.indexOf(localArray, element) == -1) { return false; } } return true; }
/** * {@inheritDoc} */ @Override public boolean containsAll(Collection<?> collection) { if (collection.isEmpty()) { return true; } final Object[] localArray = array; for (Object element : collection) { if (ArrayUtils.indexOf(localArray, element) == -1) { return false; } } return true; }
/** * {@inheritDoc} */ @Override public boolean containsAll(Collection<?> collection) { if (collection.isEmpty()) { return true; } final Object[] localArray = array; for (Object element : collection) { if (ArrayUtils.indexOf(localArray, element) == -1) { return false; } } return true; }
/** * Add unique element to the array. * @param <T> type of the array element * @param array array * @param element element to add * @param replaceElementIfEquals if passed element is equal to some element * in the array then depending on this parameter it will be * replaced or not with the passed element. * * @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(final T[] array, final T element, final boolean replaceElementIfEquals) { final int idx = indexOf(array, element); if (idx == -1) { final int length = array.length; final T[] newArray = Arrays.copyOf(array, length + 1); newArray[length] = element; return newArray; } if (replaceElementIfEquals) { array[idx] = element; } return array; }
/** * Add unique element to the array. * @param <T> type of the array element * @param array array * @param element element to add * @param replaceElementIfEquals if passed element is equal to some element * in the array then depending on this parameter it will be * replaced or not with the passed element. * * @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(final T[] array, final T element, final boolean replaceElementIfEquals) { final int idx = indexOf(array, element); if (idx == -1) { final int length = array.length; final T[] newArray = Arrays.copyOf(array, length + 1); newArray[length] = element; return newArray; } if (replaceElementIfEquals) { array[idx] = element; } return array; }
/** * Add unique element to the array. * @param <T> type of the array element * @param array array * @param element element to add * @param replaceElementIfEquals if passed element is equal to some element * in the array then depending on this parameter it will be * replaced or not with the passed element. * * @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(final T[] array, final T element, final boolean replaceElementIfEquals) { final int idx = indexOf(array, element); if (idx == -1) { final int length = array.length; final T[] newArray = Arrays.copyOf(array, length + 1); newArray[length] = element; return newArray; } if (replaceElementIfEquals) { array[idx] = element; } return array; }
/** * Add unique element to the array. * @param <T> type of the array element * @param array array * @param element element to add * @param replaceElementIfEquals if passed element is equal to some element * in the array then depending on this parameter it will be * replaced or not with the passed element. * * @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(final T[] array, final T element, final boolean replaceElementIfEquals) { final int idx = indexOf(array, element); if (idx == -1) { final int length = array.length; final T[] newArray = Arrays.copyOf(array, length + 1); newArray[length] = element; return newArray; } if (replaceElementIfEquals) { array[idx] = element; } return array; }
/** * Add unique element to the array. * @param <T> type of the array element * @param array array * @param element element to add * @param replaceElementIfEquals if passed element is equal to some element * in the array then depending on this parameter it will be * replaced or not with the passed element. * * @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(final T[] array, final T element, final boolean replaceElementIfEquals) { final int idx = indexOf(array, element); if (idx == -1) { final int length = array.length; final T[] newArray = Arrays.copyOf(array, length + 1); newArray[length] = element; return newArray; } if (replaceElementIfEquals) { array[idx] = element; } return array; }
/** * Add unique element to the array. * @param <T> type of the array element * @param array array * @param element element to add * @param replaceElementIfEquals if passed element is equal to some element * in the array then depending on this parameter it will be * replaced or not with the passed element. * * @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(final T[] array, final T element, final boolean replaceElementIfEquals) { final int idx = indexOf(array, element); if (idx == -1) { final int length = array.length; final T[] newArray = Arrays.copyOf(array, length + 1); newArray[length] = element; return newArray; } if (replaceElementIfEquals) { array[idx] = element; } return array; }
final int idx = indexOf(array, element); if (idx != -1) { final int length = array.length;
final int idx = indexOf(array, element); if (idx != -1) { final int length = array.length;