use of com.amazon.ion.IonSequence in project ion-java by amzn.
the class BaseIonSequenceLiteSublistTestCase method sublistRemoveIndexConcurrentModification.
@Test(expected = ConcurrentModificationException.class)
public void sublistRemoveIndexConcurrentModification() {
final IonSequence sequence = newSequence();
final List<IonValue> sublist = sequence.subList(2, 5);
sequence.remove(0);
sublist.remove(0);
}
use of com.amazon.ion.IonSequence in project ion-java by amzn.
the class BaseIonSequenceLiteSublistTestCase method sublistRemoveAllNotInList.
@Test
public void sublistRemoveAllNotInList() {
final IonSequence sequence = newSequence();
final List<IonValue> sublist = sequence.subList(2, 5);
final List<IonValue> toRemove = Arrays.asList(sequence.get(0), sequence.get(1));
assertFalse(sublist.removeAll(toRemove));
assertEquals(3, sublist.size());
}
use of com.amazon.ion.IonSequence in project ion-java by amzn.
the class BaseIonSequenceLiteSublistTestCase method sublistListIteratorConcurrentModification.
@Test(expected = ConcurrentModificationException.class)
public void sublistListIteratorConcurrentModification() {
final IonSequence sequence = newSequence();
final List<IonValue> sublist = sequence.subList(2, 5);
sequence.remove(0);
sublist.listIterator();
}
use of com.amazon.ion.IonSequence in project ion-java by amzn.
the class BaseIonSequenceLiteSublistTestCase method sublistListIteratorWithIndex.
@Test
public void sublistListIteratorWithIndex() {
final IonSequence sequence = newSequence();
final List<IonValue> sublist = sequence.subList(2, 5);
final ListIterator<IonValue> iterator = sublist.listIterator(1);
assertTrue(iterator.hasNext());
assertTrue(iterator.hasPrevious());
assertEquals(1, iterator.nextIndex());
assertEquals(0, iterator.previousIndex());
assertEquals(sublist.get(1), iterator.next());
// back to initial state
iterator.previous();
assertEquals(sublist.get(0), iterator.previous());
}
use of com.amazon.ion.IonSequence in project ion-java by amzn.
the class BaseIonSequenceLiteSublistTestCase method sublistClear.
@Test
public void sublistClear() {
final IonSequence sequence = newSequence();
final List<IonValue> sublist = sequence.subList(2, 5);
sublist.clear();
assertEquals(0, sublist.size());
assertEquals(4, sequence.size());
}
Aggregations