Lazy evaluation.

@param iteratorSupplier
@return
352422
public static FloatIteratorEx of(final Supplier<? extends FloatIterator> iteratorSupplier) {
        N.checkArgNotNull(iteratorSupplier, "iteratorSupplier");

        return new FloatIteratorEx() {
            private FloatIterator iter = null;
            private FloatIteratorEx iterEx = null;
            private boolean isInitialized = false;

            @Override
            public boolean hasNext() {
                if (isInitialized == false) {
                    init();
                }

                return iter.hasNext();
            }

            @Override
            public float nextFloat() {
                if (isInitialized == false) {
                    init();
                }

                return iter.nextFloat();
            }

            @Override
            public void skip(long n) {
                N.checkArgNotNegative(n, "n");

                if (isInitialized == false) {
                    init();
                }

                if (iterEx != null) {
                    iterEx.skip(n);
                } else {
                    super.skip(n);
                }
            }

            @Override
            public long count() {
                if (isInitialized == false) {
                    init();
                }

                if (iterEx != null) {
                    return iterEx.count();
                } else {
                    return super.count();
                }
            }

            @Override
            public void close() {
                if (isInitialized == false) {
                    init();
                }

                if (iterEx != null) {
                    iterEx.close();
                }
            }

            private void init() {
                if (isInitialized == false) {
                    isInitialized = true;
                    iter = iteratorSupplier.get();
                    iterEx = iter instanceof FloatIteratorEx ? (FloatIteratorEx) iter : null;
                }
            }
        };
    }
843726
public static <T> Iterator<T> toUnique(Iterator<T> self) {
        return toUnique(self, (Comparator<T>) null);
    }
115169
@Override
	public final MutableObjectIterator<T> getIterator() {
		return new MutableObjectIterator<T>()
		{
			private final int size = size();
			private int current = 0;
			
			private int currentSegment = 0;
			private int currentOffset = 0;
			
			private MemorySegment currentIndexSegment = sortIndex.get(0);

			@Override
			public T next(T target) {
				if (this.current < this.size) {
					this.current++;
					if (this.currentOffset > lastIndexEntryOffset) {
						this.currentOffset = 0;
						this.currentIndexSegment = sortIndex.get(++this.currentSegment);
					}
					
					long pointer = this.currentIndexSegment.getLong(this.currentOffset) & POINTER_MASK;
					this.currentOffset += indexEntrySize;
					
					try {
						return getRecordFromBuffer(target, pointer);
					}
					catch (IOException ioe) {
						throw new RuntimeException(ioe);
					}
				}
				else {
					return null;
				}
			}

			@Override
			public T next()
			{
				if (this.current < this.size) {
					this.current++;
					if (this.currentOffset > lastIndexEntryOffset) {
						this.currentOffset = 0;
						this.currentIndexSegment = sortIndex.get(++this.currentSegment);
					}

					long pointer = this.currentIndexSegment.getLong(this.currentOffset);
					this.currentOffset += indexEntrySize;

					try {
						return getRecordFromBuffer(pointer);
					}
					catch (IOException ioe) {
						throw new RuntimeException(ioe);
					}
				}
				else {
					return null;
				}
			}
		};
	}
488958
public static <T> ListIterator<T> nullToEmpty(final ListIterator<T> iter) {
        return iter == null ? N.<T> emptyListIterator() : iter;
    }
509305
public static <T> Iterator<T> nullToEmpty(final Iterator<T> iter) {
        return iter == null ? N.<T> emptyIterator() : iter;
    }
680980
@Override
    public IntIterator iterator() {

        return new IntIterator() {

            private int i = 0;

            @Override
            public int nextInt() {
                return i++;
            }

            @Override
            public int skip(int k) {
                return i + k;
            }

            @Override
            public boolean hasNext() {
                return i < rowCount();
            }
        };
    }
239800
public static <T> Iterator<T> filteringIterator(
        Iterator<? extends T> iterator, 
        Predicate<? super T> predicate)
    {
        Objects.requireNonNull(iterator, "The iterator is null");
        Objects.requireNonNull(predicate, "The predicate is null");
        return new FilteringIterator<T>(iterator, predicate);
    }
1192357
public static IntIteratorEx of(final Supplier<? extends IntIterator> iteratorSupplier) {
        N.checkArgNotNull(iteratorSupplier, "iteratorSupplier");

        return new IntIteratorEx() {
            private IntIterator iter = null;
            private IntIteratorEx iterEx = null;
            private boolean isInitialized = false;

            @Override
            public boolean hasNext() {
                if (isInitialized == false) {
                    init();
                }

                return iter.hasNext();
            }

            @Override
            public int nextInt() {
                if (isInitialized == false) {
                    init();
                }

                return iter.nextInt();
            }

            @Override
            public void skip(long n) {
                N.checkArgNotNegative(n, "n");

                if (isInitialized == false) {
                    init();
                }

                if (iterEx != null) {
                    iterEx.skip(n);
                } else {
                    super.skip(n);
                }
            }

            @Override
            public long count() {
                if (isInitialized == false) {
                    init();
                }

                if (iterEx != null) {
                    return iterEx.count();
                } else {
                    return super.count();
                }
            }

            @Override
            public void close() {
                if (isInitialized == false) {
                    init();
                }

                if (iterEx != null) {
                    iterEx.close();
                }
            }

            private void init() {
                if (isInitialized == false) {
                    isInitialized = true;
                    iter = iteratorSupplier.get();
                    iterEx = iter instanceof IntIteratorEx ? (IntIteratorEx) iter : null;
                }
            }
        };
    }
39052
public static ShortIterator of(final Supplier<? extends ShortIterator> iteratorSupplier) {
        N.checkArgNotNull(iteratorSupplier, "iteratorSupplier");

        return new ShortIterator() {
            private ShortIterator iter = null;
            private boolean isInitialized = false;

            @Override
            public boolean hasNext() {
                if (isInitialized == false) {
                    init();
                }

                return iter.hasNext();
            }

            @Override
            public short nextShort() {
                if (isInitialized == false) {
                    init();
                }

                return iter.nextShort();
            }

            private void init() {
                if (isInitialized == false) {
                    isInitialized = true;
                    iter = iteratorSupplier.get();
                }
            }
        };
    }
837481
public Iterator<R> iterator() {
        return new Iterator<R>() {
            R last = null;
            R next = newestBuild();

            public boolean hasNext() {
                return next!=null;
            }

            public R next() {
                last = next;
                if (last!=null)
                    next = last.getPreviousBuild();
                else
                    throw new NoSuchElementException();
                return last;
            }

            public void remove() {
                if (last==null)
                    throw new UnsupportedOperationException();
                removeValue(last);
            }
        };
    }
257418
public JodaBeanSer withIteratorFactory(SerIteratorFactory iteratorFactory) {
        JodaBeanUtils.notNull(iteratorFactory, "iteratorFactory");
        return new JodaBeanSer(indent, newLine, converter, iteratorFactory, shortTypes, deserializers, includeDerived);
    }
282326
public static <E> ImmutableIterator<E> makeImmutable(final Iterator<E> iterator) {
        return new ImmutableIterator<E>() {
            @Override
            public boolean hasNext() {
                return iterator.hasNext();
            }

            @Override
            public E next() {
                return iterator.next();
            }
        };
    }
1339330
public <T extends Evaluation> T evaluate(DataSetIterator iterator) {
        return (T)evaluate(iterator, null);
    }
934803
public static FloatIterator of(final Supplier<? extends FloatIterator> iteratorSupplier) {
        N.checkArgNotNull(iteratorSupplier, "iteratorSupplier");

        return new FloatIterator() {
            private FloatIterator iter = null;
            private boolean isInitialized = false;

            @Override
            public boolean hasNext() {
                if (isInitialized == false) {
                    init();
                }

                return iter.hasNext();
            }

            @Override
            public float nextFloat() {
                if (isInitialized == false) {
                    init();
                }

                return iter.nextFloat();
            }

            private void init() {
                if (isInitialized == false) {
                    isInitialized = true;
                    iter = iteratorSupplier.get();
                }
            }
        };
    }
1215592
public static <T> Stream<T> toIterator(@javax.annotation.Nonnull final Iterator<T> iterator) {
    return StreamSupport.stream(Spliterators.spliterator(iterator, 1, Spliterator.ORDERED), false);
  }
1090302
public static <T> ObjIteratorEx<T> oF(final Supplier<T[]> arraySupplier) {
        N.checkArgNotNull(arraySupplier, "arraySupplier");

        return new ObjIteratorEx<T>() {
            private ObjIteratorEx<T> iterEx = null;
            private boolean isInitialized = false;

            @Override
            public boolean hasNext() {
                if (isInitialized == false) {
                    init();
                }

                return iterEx.hasNext();
            }

            @Override
            public T next() {
                if (isInitialized == false) {
                    init();
                }

                return iterEx.next();
            }

            @Override
            public void skip(long n) {
                N.checkArgNotNegative(n, "n");

                if (isInitialized == false) {
                    init();
                }

                iterEx.skip(n);
            }

            @Override
            public long count() {
                if (isInitialized == false) {
                    init();
                }

                return iterEx.count();
            }

            private void init() {
                if (isInitialized == false) {
                    isInitialized = true;
                    iterEx = ObjIteratorEx.of(arraySupplier.get());
                }
            }
        };
    }
624322
public static <T> Iterator<T> toUnique(Iterator<T> self) {
        return new UniqueIterator<T>(self, null);
    }