Class EmptyIterable<E>

  • Type Parameters:
    E - the type of elements returned by the iterable's iterator
    All Implemented Interfaces:
    java.io.Serializable, java.lang.Iterable<E>

    public final class EmptyIterable<E>
    extends java.lang.Object
    implements java.lang.Iterable<E>, java.io.Serializable
    An EmptyIterable is just that. Maybe just a touch better-performing than Collections.EMPTY_SET since we don't create a new Iterator every time iterator() is called. (Not sure why they do that....)
    Version:
    2.5
    See Also:
    EmptyIterator, EmptyListIterable, Serialized Form
    Since:
    2.5
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static <T> java.lang.Iterable<T> instance()
      Return the singleton instance of this Iterable.
      java.util.Iterator<E> iterator()
      java.lang.String toString()
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.lang.Iterable

        forEach, spliterator
    • Method Detail

      • instance

        public static <T> java.lang.Iterable<T> instance()
        Return the singleton instance of this Iterable.
        Returns:
        The singleton instance
      • iterator

        public java.util.Iterator<E> iterator()
        Specified by:
        iterator in interface java.lang.Iterable<E>
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object