daily pastebin goal
63%
SHARE
TWEET

Untitled

a guest Apr 16th, 2018 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public Iterator<T> iterator() {
  2.   return new Iterator<T> () {
  3.     int pos = 0;
  4.  
  5.     @Override
  6.     public boolean hasNext() {
  7.       return pos < arr.length;
  8.     }
  9.  
  10.     @Override
  11.     public T next() throws NoSuchElementException {
  12.       if (hasNext) return arr[pos++];
  13.       else throw new NoSuchElementException;
  14.     }
  15. }
RAW Paste Data
Top