saker.util Documentation TaskDoc JavaDoc Packages
package saker.util
public interface PeekableIterable<Textends Iterable<T>
Iterable subinterface that supports peeking the first element, and checking if it is empty.

The purpose of this interface is to be able to query some information without the need of creating a new Iterator.

TThe element type.
Methods
public boolean
Checks if the iterable is empty.
public T
Gets the first element in this iterable, or null if there's none.
Inherited methods
From: Iterable<T>
public abstract boolean isEmpty()
Checks if the iterable is empty.

If it is empty, peek() will return null, and any iterators created will have no next elements.

true if the iterable contains no elements.
public abstract T peek()
Gets the first element in this iterable, or null if there's none.

If the first element is null, this method returns the same nonetheless. Clients are recommended to check isEmpty() if the iterable may contain nulls.

The first element or null, if there's none.