@Test public void testRemove() throws Exception { JCas jCas = JCasFactory.createJCas("de.julielab.jcore.types.jcore-morpho-syntax-types"); List<Token> tokenList = new ArrayList<>(); Token t1 = new Token(jCas, 11, 17); Token t2 = new Token(jCas, 5, 10); Token t3 = new Token(jCas, 1, 20); Token t4 = new Token(jCas, 3, 5); tokenList.addAll(Arrays.asList(t1, t2, t3, t4)); Token token; JCoReFSListIterator<Token> it = new JCoReFSListIterator<>(tokenList); assertTrue(it.hasNext()); token = (Token) it.next(); assertEquals(t1, token); assertTrue(it.hasNext()); token = (Token) it.next(); assertEquals(t2, token); it.remove(); assertTrue(it.isValid()); assertEquals(t3, it.get()); assertTrue(it.hasNext()); token = (Token) it.next(); assertEquals(t4, token); it.moveToFirst(); it = new JCoReFSListIterator<>(tokenList); assertTrue(it.hasNext()); token = (Token) it.next(); assertEquals(t1, token); assertTrue(it.hasNext()); token = (Token) it.next(); assertEquals(t3, token); assertTrue(it.hasNext()); token = (Token) it.next(); assertEquals(t4, token); assertFalse(it.hasNext()); }
@Override public void remove() { fsList.remove(pos); }
JCoReFSListIterator implements FSIterator<T> { @Override public void remove() { fsList.remove(pos); } }
JCoReFSListIterator implements FSIterator<T> { @Override public void remove() { fsList.remove(pos); } JCoReFSListIterator(List<T> list); }
JCoReFSListIterator implements FSIterator<T> { @Override public void remove() { fsList.remove(pos); } JCoReFSListIterator(List<T> list); @Override boolean hasNext(); @Override T next(); @Override void remove(); @Override boolean isValid(); @Override T get(); @Override void moveToNext(); @Override void moveToPrevious(); @Override void moveToFirst(); @Override void moveToLast(); @Override void moveTo(FeatureStructure fs); @Override FSIterator<T> copy(); }
JCoReFSListIterator implements FSIterator<T> { @Override public void remove() { fsList.remove(pos); } JCoReFSListIterator(List<T> list); @Override boolean hasNext(); @Override T next(); @Override void remove(); @Override boolean isValid(); @Override T get(); @Override void moveToNext(); @Override void moveToPrevious(); @Override void moveToFirst(); @Override void moveToLast(); @Override void moveTo(FeatureStructure fs); @Override FSIterator<T> copy();  }