Class Frozen<T>

  • All Implemented Interfaces:
    java.lang.Iterable<T>

    public final class Frozen<T>
    extends java.lang.Object
    implements java.lang.Iterable<T>
    An Iterable stores the elements of the given Iterator or Iterable in order to allow re-iterating them.

    This is meant to speed up repeated access to slow iterators.

    Note that Frozen needs to synchronize access to the original iterator (and an internal list), which causes some overhead. So only use this if reiterating the original source is impossible or expensive (compared to the number of times you need to reiterate).

    • Constructor Summary

      Constructors 
      Constructor Description
      Frozen​(java.lang.Iterable<T> delegate)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.Iterator<T> iterator()  
      • Methods inherited from class java.lang.Object

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

        forEach, spliterator
    • Constructor Detail

      • Frozen

        public Frozen​(java.lang.Iterable<T> delegate)
    • Method Detail

      • iterator

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