/** * Returns the index of the first occurrence of the specified * element. Returns <code>-1</code> if the receiver does not contain this element. * * @param element the element to be searched for. * @return the index of the first occurrence of the element in the receiver; returns <code>-1</code> if the element is not found. */ public int indexOf(int element) { //delta return indexOfFromTo(element, 0, size-1); } /**
/** * Returns true if the receiver contains the specified element. * * @param element element whose presence in the receiver is to be tested. */ public boolean contains(int elem) { return indexOfFromTo(elem,0,size-1) >=0; } /**
/** * Returns true if the receiver contains the specified element. * * @param element element whose presence in the receiver is to be tested. */ public boolean contains(int elem) { return indexOfFromTo(elem,0,size-1) >=0; } /**
/** * Returns true if the receiver contains the specified element. * * @param elem * element whose presence in the receiver is to be tested. */ public boolean contains(int elem) { return indexOfFromTo(elem, 0, size - 1) >= 0; }
/** * Returns the index of the first occurrence of the specified * element. Returns <code>-1</code> if the receiver does not contain this element. * * @param element the element to be searched for. * @return the index of the first occurrence of the element in the receiver; returns <code>-1</code> if the element is not found. */ public int indexOf(int element) { //delta return indexOfFromTo(element, 0, size-1); } /**
/** * Returns the index of the first occurrence of the specified element. * Returns <code>-1</code> if the receiver does not contain this element. * * @param element * the element to be searched for. * @return the index of the first occurrence of the element in the receiver; * returns <code>-1</code> if the element is not found. */ public int indexOf(int element) { // delta return indexOfFromTo(element, 0, size - 1); }
/** * Deletes the first element from the receiver that is identical to the specified element. * Does nothing, if no such matching element is contained. * * @param element the element to be deleted. */ public void delete(int element) { int index = indexOfFromTo(element, 0, size-1); if (index>=0) remove(index); } /**
/** * Deletes the first element from the receiver that is identical to the specified element. * Does nothing, if no such matching element is contained. * * @param element the element to be deleted. */ public void delete(int element) { int index = indexOfFromTo(element, 0, size-1); if (index>=0) remove(index); } /**
/** * Deletes the first element from the receiver that is identical to the * specified element. Does nothing, if no such matching element is * contained. * * @param element * the element to be deleted. */ public void delete(int element) { int index = indexOfFromTo(element, 0, size - 1); if (index >= 0) remove(index); }
/** * Removes from the receiver all elements that are contained in the specified list. * Tests for identity. * * @param other the other list. * @return <code>true</code> if the receiver changed as a result of the call. */ public boolean removeAll(AbstractIntList other) { if (other.size()==0) return false; //nothing to do int limit = other.size()-1; int j=0; for (int i=0; i<size ; i++) { if (other.indexOfFromTo(getQuick(i), 0, limit) < 0) setQuick(j++,getQuick(i)); } boolean modified = (j!=size); setSize(j); return modified; } /**
/** * Removes from the receiver all elements that are contained in the specified list. * Tests for identity. * * @param other the other list. * @return <code>true</code> if the receiver changed as a result of the call. */ public boolean removeAll(AbstractIntList other) { if (other.size()==0) return false; //nothing to do int limit = other.size()-1; int j=0; for (int i=0; i<size ; i++) { if (other.indexOfFromTo(getQuick(i), 0, limit) < 0) setQuick(j++,getQuick(i)); } boolean modified = (j!=size); setSize(j); return modified; } /**
/** * Removes from the receiver all elements that are contained in the * specified list. Tests for identity. * * @param other * the other list. * @return <code>true</code> if the receiver changed as a result of the * call. */ public boolean removeAll(AbstractIntList other) { if (other.size() == 0) return false; // nothing to do int limit = other.size() - 1; int j = 0; for (int i = 0; i < size; i++) { if (other.indexOfFromTo(getQuick(i), 0, limit) < 0) setQuick(j++, getQuick(i)); } boolean modified = (j != size); setSize(j); return modified; }
/** * Retains (keeps) only the elements in the receiver that are contained in the specified other list. * In other words, removes from the receiver all of its elements that are not contained in the * specified other list. * @param other the other list to test against. * @return <code>true</code> if the receiver changed as a result of the call. */ public boolean retainAll(AbstractIntList other) { if (other.size()==0) { if (size==0) return false; setSize(0); return true; } int limit = other.size()-1; int j=0; for (int i=0; i<size ; i++) { if (other.indexOfFromTo(getQuick(i), 0, limit) >= 0) setQuick(j++, getQuick(i)); } boolean modified = (j!=size); setSize(j); return modified; } /**
/** * Retains (keeps) only the elements in the receiver that are contained in the specified other list. * In other words, removes from the receiver all of its elements that are not contained in the * specified other list. * @param other the other list to test against. * @return <code>true</code> if the receiver changed as a result of the call. */ public boolean retainAll(AbstractIntList other) { if (other.size()==0) { if (size==0) return false; setSize(0); return true; } int limit = other.size()-1; int j=0; for (int i=0; i<size ; i++) { if (other.indexOfFromTo(getQuick(i), 0, limit) >= 0) setQuick(j++, getQuick(i)); } boolean modified = (j!=size); setSize(j); return modified; } /**
/** * Retains (keeps) only the elements in the receiver that are contained in * the specified other list. In other words, removes from the receiver all * of its elements that are not contained in the specified other list. * * @param other * the other list to test against. * @return <code>true</code> if the receiver changed as a result of the * call. */ public boolean retainAll(AbstractIntList other) { if (other.size() == 0) { if (size == 0) return false; setSize(0); return true; } int limit = other.size() - 1; int j = 0; for (int i = 0; i < size; i++) { if (other.indexOfFromTo(getQuick(i), 0, limit) >= 0) setQuick(j++, getQuick(i)); } boolean modified = (j != size); setSize(j); return modified; }
if (other.indexOfFromTo(theElements[i], 0, limit) >= 0) theElements[j++]=theElements[i];
if (other.indexOfFromTo(theElements[i], 0, limit) >= 0) theElements[j++]=theElements[i];
if (other.indexOfFromTo(theElements[i], 0, limit) < 0) theElements[j++]=theElements[i];
if (other.indexOfFromTo(theElements[i], 0, limit) < 0) theElements[j++] = theElements[i];
if (other.indexOfFromTo(theElements[i], 0, limit) < 0) theElements[j++]=theElements[i];