@Test(expected = UnsupportedOperationException.class) public void testReadOnly() throws Exception { Iterator<String> iterator = create3().iterator(); iterator.next(); iterator.remove(); }
@Override public Iterator<T> iterator() { return new ReadOnlyIterator<T>() { int index; @Override public boolean hasNext() { return index < length; } @Override public T next() { return get.call(index++); } }; }
FixedSizeStream extends Stream<T> { @Override public Iterator<T> iterator() { return new ReadOnlyIterator<T>() { int index; @Override public boolean hasNext() { return index < length; } @Override public T next() { return get.call(index++); } }; } }
FixedSizeStream extends Stream<T> { @Override public Iterator<T> iterator() { return new ReadOnlyIterator<T>() { int index; @Override public boolean hasNext() { return index < length; } @Override public T next() { return get.call(index++); } }; } FixedSizeStream(int length, Func1<Integer, T> get); }
FixedSizeStream extends Stream<T> { @Override public Iterator<T> iterator() { return new ReadOnlyIterator<T>() { int index; @Override public boolean hasNext() { return index < length; } @Override public T next() { return get.call(index++); } }; } FixedSizeStream(int length, Func1<Integer, T> get); @Override Iterator<T> iterator(); }
FixedSizeStream extends Stream<T> { @Override public Iterator<T> iterator() { return new ReadOnlyIterator<T>() { int index; @Override public boolean hasNext() { return index < length; } @Override public T next() { return get.call(index++); } }; } FixedSizeStream(int length, Func1<Integer, T> get); @Override Iterator<T> iterator();  }