static boolean containsAll(Collection<?> collection, Object[] snapshot, int from, int to) { for (Object o : collection) { if (indexOf(o, snapshot, from, to) == -1) { return false; } } return true; }
/** * Searches this list for {@code object} and returns the index of the first * occurrence that is at or after {@code from}. * * @return the index or -1 if the object was not found. */ public int indexOf(E object, int from) { Object[] snapshot = elements; return indexOf(object, snapshot, from, snapshot.length); }
public int indexOf(Object object) { Object[] snapshot = elements; return indexOf(object, snapshot, 0, snapshot.length); }
public boolean contains(Object o) { return indexOf(o) != -1; }
public synchronized boolean remove(Object o) { int index = indexOf(o); if (index == -1) { return false; } remove(index); return true; }
/** * Adds the elements of {@code collection} that are not already present in * this list. If {@code collection} includes a repeated value, at most one * occurrence of that value will be added to this list. Elements are added * at the end of this list. * * <p>Callers of this method may prefer {@link CopyOnWriteArraySet}, whose * API is more appropriate for set operations. */ public synchronized int addAllAbsent(Collection<? extends E> collection) { Object[] toAdd = collection.toArray(); Object[] newElements = new Object[elements.length + toAdd.length]; System.arraycopy(elements, 0, newElements, 0, elements.length); int addedCount = 0; for (Object o : toAdd) { if (indexOf(o, newElements, 0, elements.length + addedCount) == -1) { newElements[elements.length + addedCount++] = o; } } if (addedCount < toAdd.length) { newElements = Arrays.copyOfRange( newElements, 0, elements.length + addedCount); // trim to size } elements = newElements; return addedCount; }
public void replaceMember(Item oldItem, Item newItem) { if (oldItem == null || newItem == null) { throw new IllegalArgumentException("Items must not be null!"); } int index = members.indexOf(oldItem); if (index > -1) { Item old = members.set(index, newItem); unregisterStateListener(old); } registerStateListener(newItem); }
static boolean containsAll(Collection<?> collection, Object[] snapshot, int from, int to) { for (Object o : collection) { if (indexOf(o, snapshot, from, to) == -1) { return false; } } return true; }
/** * Searches this list for {@code object} and returns the index of the first * occurrence that is at or after {@code from}. * * @return the index or -1 if the object was not found. */ public int indexOf(E object, int from) { Object[] snapshot = elements; return indexOf(object, snapshot, from, snapshot.length); }
/** * Searches this list for {@code object} and returns the index of the first * occurrence that is at or after {@code from}. * * @return the index or -1 if the object was not found. */ public int indexOf(E object, int from) { Object[] snapshot = elements; return indexOf(object, snapshot, from, snapshot.length); }
/** * Gets the position of the given provider in the provider queue. * * @param provider The provider. * @return The provider's index. */ public synchronized int indexOf(IAudioProvider provider) { return providers.indexOf(provider); }
/** * Gets the position of the provided processor in the processor queue. * * @param processor The processor. * @return The processor's index. */ public synchronized int indexOf(IAudioProcessor processor) { return processors.indexOf(processor); }
static boolean containsAll(Collection<?> collection, Object[] snapshot, int from, int to) { for (Object o : collection) { if (indexOf(o, snapshot, from, to) == -1) { return false; } } return true; }
static boolean containsAll(Collection<?> collection, Object[] snapshot, int from, int to) { for (Object o : collection) { if (indexOf(o, snapshot, from, to) == -1) { return false; } } return true; }
/** * Searches this list for {@code object} and returns the index of the first * occurrence that is at or after {@code from}. * * @return the index or -1 if the object was not found. */ public int indexOf(E object, int from) { Object[] snapshot = elements; return indexOf(object, snapshot, from, snapshot.length); }
/** * Adds a provider to the internal provider queue. * * @param provider The provider to add. * @return The index of the provider. */ public synchronized int add(IAudioProvider provider) { providers.add(provider); return providers.indexOf(provider); }
public synchronized boolean remove(Object o) { int index = indexOf(o); if (index == -1) { return false; } remove(index); return true; }
public synchronized boolean remove(Object o) { int index = indexOf(o); if (index == -1) { return false; } remove(index); return true; }
public synchronized boolean remove(Object o) { int index = indexOf(o); if (index == -1) { return false; } remove(index); return true; }
/** * Adds a processor to the internal processor queue. * * @param processor The processor to add. * @return The index of the processor. */ public synchronized int add(IAudioProcessor processor) { processors.add(processor); buildFinalProcessor(); return processors.indexOf(processor); }