public Iterator<E> snapshotIterator(E item) { List<E> l = new ArrayList<E>(map.size()); Iterator<E> it = new LinkIterator<E>(item); while (it.hasNext()) { l.add(it.next()); } return l.iterator(); }
public Iterator<E> snapshotIterator( Object item) { List l = new ArrayList( map.size()); Iterator it = new LinkIterator( item); while (it.hasNext()) l.add( it.next()); return l.iterator(); }
public Iterator<E> snapshotIterator( Object item) { List l = new ArrayList( map.size()); Iterator it = new LinkIterator( item); while (it.hasNext()) l.add( it.next()); return l.iterator(); }
/** <p>Returns an iterator ranging from <code>head</code> to * <code>tail</code>, inclusive.</p> <p>If <code>tail</code> is the element immediately preceding <code>head</code> in this <code>HashChain</code>, the returned iterator will iterate 0 times (a special case to allow the specification of an empty range of elements). Otherwise if <code>tail</code> is not one of the elements following <code>head</code>, the returned iterator will iterate past the end of the <code>HashChain</code>, provoking a {@link NoSuchElementException}.</p> @throws NoSuchElementException if <code>head</code> is not an element of the chain. */ public Iterator<E> iterator(E head, E tail) { if (head != null && this.getPredOf(head) == tail) { // special case hack, so empty ranges iterate 0 times return new LinkIterator(null, null); } else { return new LinkIterator(head, tail); } }
/** <p>Returns an iterator ranging from <code>head</code> to * <code>tail</code>, inclusive.</p> <p>If <code>tail</code> is the element immediately preceding <code>head</code> in this <code>HashChain</code>, the returned iterator will iterate 0 times (a special case to allow the specification of an empty range of elements). Otherwise if <code>tail</code> is not one of the elements following <code>head</code>, the returned iterator will iterate past the end of the <code>HashChain</code>, provoking a {@link NoSuchElementException}.</p> @throws NoSuchElementException if <code>head</code> is not an element of the chain. */ public Iterator<E> iterator(E head, E tail) { if (head != null && this.getPredOf(head) == tail) { // special case hack, so empty ranges iterate 0 times return new LinkIterator(null, null); } else { return new LinkIterator(head, tail); } }
public Iterator<E> iterator(E item) { return new LinkIterator<E>(item); }
public Iterator<E> iterator(E item) { return new LinkIterator<E>(item); }
/** * <p> * Returns an iterator ranging from <code>head</code> to <code>tail</code>, inclusive. * </p> * * <p> * If <code>tail</code> is the element immediately preceding <code>head</code> in this <code>HashChain</code>, the returned * iterator will iterate 0 times (a special case to allow the specification of an empty range of elements). Otherwise if * <code>tail</code> is not one of the elements following <code>head</code>, the returned iterator will iterate past the * end of the <code>HashChain</code>, provoking a {@link NoSuchElementException}. * </p> * * @throws NoSuchElementException * if <code>head</code> is not an element of the chain. */ @Override @SuppressWarnings("unchecked") public Iterator<E> iterator(E head, E tail) { if (firstItem == null || isEmpty()) { return (Iterator<E>) emptyIterator; } if (head != null && this.getPredOf(head) == tail) { return (Iterator<E>) emptyIterator; } return new LinkIterator<E>(head, tail); }
@Override @SuppressWarnings("unchecked") public Iterator<E> iterator() { if (firstItem == null || isEmpty()) { return (Iterator<E>) emptyIterator; } return new LinkIterator<E>(firstItem); }
@Override @SuppressWarnings("unchecked") public Iterator<E> iterator(E item) { if (firstItem == null || isEmpty()) { return (Iterator<E>) emptyIterator; } return new LinkIterator<E>(item); }