Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.hp.hpl.jena.util.iterator
Class NiceIterator

    java.lang.Object
      com.hp.hpl.jena.util.iterator.NiceIterator

All Implemented Interfaces:
  ClosableIterator, ExtendedIterator, java.util.Iterator

Direct Known Subclasses:
  MapFilterIterator, NullIterator, SingletonIterator, WrappedIterator

    public class NiceIterator

extends java.lang.Object
implements ExtendedIterator

NiceIterator is the standard base class implementing ExtendedIterator. It provides the static methods for `andThen`, `filterKeep` and `filterDrop`; these can be reused from any other class. It defines equivalent instance methods for descendants and to satisfy ExtendedIterator.

Author:
  kers

Constructor Summary
`NiceIterator()`

Method Summary
`ExtendedIterator` | `andThen(ClosableIterator other)` make a new iterator, which is us then the other chap.
`static ExtendedIterator` | `andThen(java.util.Iterator a, java.util.Iterator b)` concatenate two closable iterators.
`static java.util.List` | `asList(ExtendedIterator it)` Answer a list of the elements from `it`, in order, consuming that iterator.
`static java.util.Set` | `asSet(ExtendedIterator it)` Answer a list of the elements of `it` in order, consuming this iterator.
`void` | `close()` default close: don't need to do anything.
`static void` | `close(java.util.Iterator it)` If `it` is a Closableiterator, close it.
`static ExtendedIterator` | `emptyIterator()` An iterator over no elements.
`ExtendedIterator` | `filterDrop(Filter f)` make a new iterator, which is our elements that do not pass the filter
`ExtendedIterator` | `filterKeep(Filter f)` make a new iterator, which is our elements that pass the filter
`boolean` | `hasNext()` default hasNext: no elements, return false.
`ExtendedIterator` | `mapWith(Map1 map1)` make a new iterator which is the elementwise _map1_ of the base iterator.
`java.lang.Object` | `next()` default next: throw an exception.
`void` | `remove()` default remove: we have no elements, so we can't remove any.
`java.lang.Object` | `removeNext()` Answer the next object, and remove it.
`java.util.List` | `toList()` Answer a list of the elements in order, consuming this iterator.
`java.util.Set` | `toSet()` Answer a list of the elements in order, consuming this iterator.

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### NiceIterator

    public NiceIterator()

Method Detail

### close

    public void close()

  default close: don't need to do anything.

  Specified by:
    `close` in interface `ClosableIterator`

### hasNext

    public boolean hasNext()

  default hasNext: no elements, return false.

  Specified by:
    `hasNext` in interface `java.util.Iterator`

### next

    public java.lang.Object next()

  default next: throw an exception.

  Specified by:
    `next` in interface `java.util.Iterator`

### remove

    public void remove()

  default remove: we have no elements, so we can't remove any.

  Specified by:
    `remove` in interface `java.util.Iterator`

### removeNext

    public java.lang.Object removeNext()

  Answer the next object, and remove it.

  Specified by:
    `removeNext` in interface `ExtendedIterator`

### andThen

    public static ExtendedIterator andThen(java.util.Iterator a,
                                           java.util.Iterator b)

  concatenate two closable iterators.

### andThen

    public ExtendedIterator andThen(ClosableIterator other)

  make a new iterator, which is us then the other chap.

  Specified by:
    `andThen` in interface `ExtendedIterator`

### filterKeep

    public ExtendedIterator filterKeep(Filter f)

  make a new iterator, which is our elements that pass the filter

  Specified by:
    `filterKeep` in interface `ExtendedIterator`

### filterDrop

    public ExtendedIterator filterDrop(Filter f)

  make a new iterator, which is our elements that do not pass the filter

  Specified by:
    `filterDrop` in interface `ExtendedIterator`

### mapWith

    public ExtendedIterator mapWith(Map1 map1)

  make a new iterator which is the elementwise _map1_ of the base iterator.

  Specified by:
    `mapWith` in interface `ExtendedIterator`

### close

    public static void close(java.util.Iterator it)

  If `it` is a Closableiterator, close it. Abstracts away from tests [that were] scattered through the code.

### emptyIterator

    public static ExtendedIterator emptyIterator()

  An iterator over no elements.

  Returns:
    A class singleton which doesn't iterate.

### toList

    public java.util.List toList()

  Answer a list of the elements in order, consuming this iterator.

  Specified by:
    `toList` in interface `ExtendedIterator`

### toSet

    public java.util.Set toSet()

  Answer a list of the elements in order, consuming this iterator.

  Specified by:
    `toSet` in interface `ExtendedIterator`

### asSet

    public static java.util.Set asSet(ExtendedIterator it)

  Answer a list of the elements of `it` in order, consuming this iterator. Canonical implementation of toSet().

### asList

    public static java.util.List asList(ExtendedIterator it)

  Answer a list of the elements from `it`, in order, consuming that iterator. Canonical implementation of toList().

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Hewlett-Packard Development Company, LP