コード例 #1
0
 @Test
 public void testRemoveWithIndex() {
   MutableList<String> list = new CompositeFastList<String>();
   list.addAll(FastList.newListWith("1", "2", "3", "4"));
   list.addAll(FastList.newListWith("3", "B", "3", "B"));
   Assert.assertEquals("1", list.remove(0));
   Verify.assertSize(7, list);
   Assert.assertEquals("2", list.getFirst());
   Assert.assertEquals("B", list.remove(6));
   Verify.assertSize(6, list);
   Assert.assertEquals("3", list.getLast());
 }
コード例 #2
0
 @Override
 @Test
 public void set() {
   super.set();
   MutableList<String> list = new CompositeFastList<String>();
   list.addAll(FastList.newListWith("1", "2", "3", "4"));
   list.addAll(FastList.newListWith("A", "B", "C", "B"));
   Assert.assertEquals("1", list.set(0, "NEW"));
   Verify.assertSize(8, list);
   Assert.assertEquals("NEW", list.getFirst());
   Assert.assertEquals("2", list.get(1));
   Assert.assertEquals("B", list.set(7, "END"));
   Verify.assertSize(8, list);
   Assert.assertEquals("END", list.getLast());
 }
コード例 #3
0
 @Test
 public void testAddWithIndex() {
   MutableList<String> list = new CompositeFastList<String>();
   list.addAll(FastList.newListWith("1", "2", "3", "4"));
   list.addAll(FastList.newListWith("A", "B", "C", "B"));
   list.add(3, "NEW");
   Verify.assertSize(9, list);
   Assert.assertEquals("NEW", list.get(3));
   Assert.assertEquals("4", list.get(4));
   list.add(0, "START");
   Verify.assertSize(10, list);
   Assert.assertEquals("START", list.getFirst());
   list.add(10, "END");
   Verify.assertSize(11, list);
   Assert.assertEquals("END", list.getLast());
 }