@Override
    public T next(){
        synchronized(lock){
            if(currentIndex >= contents.length){
                throw new NoSuchElementException();
            }
            final T out = contents[currentIndex];
            currentIndex++;
            return out;
        }
    }
@Override
    public T next()