public ConsPStack<E> minus(final int i) { if (i < 0 || i >= size) throw new IndexOutOfBoundsException("Index: " + i + "; size: " + size); else if (i == 0) return rest; else return new ConsPStack<E>(first, rest.minus(i-1)); }
public ConsPStack<E> minus(final Object e) { if(size==0) return this; if(first.equals(e)) // found it return rest; // don't recurse (only remove one) // otherwise keep looking: ConsPStack<E> newRest = rest.minus(e); if(newRest==rest) return this; return new ConsPStack<E>(first, newRest); }
public ConsPStack<E> minus(final int i) { if (i < 0 || i >= size) throw new IndexOutOfBoundsException("Index: " + i + "; size: " + size); else if (i == 0) return rest; else return new ConsPStack<E>(first, rest.minus(i-1)); }
public ConsPStack<E> minus(final Object e) { if(size==0) return this; if(first.equals(e)) // found it return rest; // don't recurse (only remove one) // otherwise keep looking: ConsPStack<E> newRest = rest.minus(e); if(newRest==rest) return this; return new ConsPStack<E>(first, newRest); }
public ConsPStack<E> minus(final int i) { if (i < 0 || i >= size) throw new IndexOutOfBoundsException("Index: " + i + "; size: " + size); else if (i == 0) return rest; else return new ConsPStack<E>(first, rest.minus(i-1)); }
public ConsPStack<E> minus(final Object e) { if (size == 0) return this; if (first.equals(e)) // found it return rest; // don't recurse (only remove one) // otherwise keep looking: ConsPStack<E> newRest = rest.minus(e); if (newRest == rest) return this; return new ConsPStack<E>(first, newRest); }
public ConsPStack<E> minus(final Object e) { if(size==0) return this; if(first.equals(e)) // found it return rest; // don't recurse (only remove one) // otherwise keep looking: ConsPStack<E> newRest = rest.minus(e); if(newRest==rest) return this; return new ConsPStack<E>(first, newRest); }
ConsPStack.empty().plusAll(UtilityTest.reverse(pstack))); UtilityTest.assertEqualsAndHash(pstack, ConsPStack.singleton(10).plusAll(1,UtilityTest.reverse(pstack)).minus(0));
public ConsPStack<E> minus(final int i) { return minus(get(i)); }