Advertisement
Guest User

Untitled

a guest
Feb 20th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. package org.idey.algo.iterator.peek;
  2.  
  3. import java.util.Iterator;
  4.  
  5. /**
  6. * Special Iterator which will provide addiotnal method {@link PeekIterator#peek()}
  7. * @param <T> return the current object
  8. *
  9. */
  10. public interface PeekIterator<T> extends Iterator<T> {
  11. /**
  12. * This method always current element from the iterator. During the process of peeking element it will not
  13. * advance the iterator
  14. * @return T current object
  15. * @throws java.util.NoSuchElementException in case there is no more elements or the iterator is null
  16. */
  17. T peek();
  18.  
  19. /**
  20. * @throws UnsupportedOperationException as this is not supported
  21. */
  22. default void remove() {
  23. throw new UnsupportedOperationException("Invalid Operations");
  24. }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement