
com.github.sirikid.iterators.EmptyIterator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of maybe Show documentation
Show all versions of maybe Show documentation
Implementation Maybe monad in Java
/*
* Copyright (c) 2016, Ivan Sokolov. All rights reserved.
* This code is licensed under MIT license (see LICENSE for details)
*/
package com.github.sirikid.iterators;
import java.util.Iterator;
import java.util.NoSuchElementException;
/**
* Empty iterator. Use it when need return an iterator, but you have no elements.
*
* @author Ivan Sokolov
* @version 1.0.0
* @param type of elements
* @see EmptySpliterator
* @since 1.0.0
*/
public class EmptyIterator implements Iterator {
/** {@inheritDoc} */
@Override
public boolean hasNext() {
return false;
}
/** {@inheritDoc} */
@Override
public E next() {
throw new NoSuchElementException();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy