Package java.util

Examples of java.util.ListIterator.previous()


    public void testRemovePrevious() throws Exception {
        Data[] d = {new Data(0), new Data(1), new Data(2)};
        list.addAll(Arrays.asList(d));

        ListIterator i = list.listIterator(list.size());
        i.previous();
        i.previous();
        i.remove();
        assertEquals(2, list.size());
        assertTrue(i.hasPrevious());
        assertEquals(d[0], i.previous());
View Full Code Here


        Data[] d = {new Data(0), new Data(1), new Data(2)};
        list.addAll(Arrays.asList(d));

        ListIterator i = list.listIterator(list.size());
        i.previous();
        i.previous();
        i.remove();
        assertEquals(2, list.size());
        assertTrue(i.hasPrevious());
        assertEquals(d[0], i.previous());
        assertTrue(!i.hasPrevious());
View Full Code Here

        i.previous();
        i.previous();
        i.remove();
        assertEquals(2, list.size());
        assertTrue(i.hasPrevious());
        assertEquals(d[0], i.previous());
        assertTrue(!i.hasPrevious());
        assertTrue(i.hasNext());
        assertEquals(d[0], i.next());
        assertTrue(i.hasNext());
        assertEquals(d[2], i.next());
View Full Code Here

    public void testRemoveLast() throws Exception {
        Data[] d = {new Data(0), new Data(1), new Data(2)};
        list.addAll(Arrays.asList(d));

        ListIterator i = list.listIterator(list.size());
        i.previous();
        i.remove();
        assertEquals(2, list.size());
        assertTrue(i.hasPrevious());
        assertTrue(!i.hasNext());
    }
View Full Code Here

        ListIterator i = list.listIterator();
        Data d1 = new Data(5);
        assertTrue(!i.hasPrevious());
        i.add(d1);
        assertTrue(i.hasPrevious());
        assertEquals(d1, i.previous());
        assertEquals(d1, i.next());
        assertEquals(d[0], i.next());
        assertEquals(d1, list.get(0));
    }
View Full Code Here

        i.add(d1);
        assertTrue(i.hasPrevious());
        assertTrue(!i.hasNext());
        assertEquals(4, list.size());

        assertEquals(d1, i.previous());
        assertEquals(d1, i.next());
        assertEquals(d1, list.get(3));
    }

    @Test
View Full Code Here

        i.add(d1);
        assertTrue(i.hasPrevious());
        assertTrue(i.hasNext());
        assertEquals(4, list.size());

        assertEquals(d1, i.previous());
        assertEquals(d1, i.next());
        assertEquals(d1, list.get(1));
    }

    @Test
View Full Code Here

        i.next();
        i.set(d2);
        assertEquals(1, list.size());
        assertTrue(!i.hasNext());
        assertTrue(i.hasPrevious());
        assertEquals(d2, i.previous());
        assertTrue(i.hasNext());
        assertTrue(!i.hasPrevious());
        assertEquals(d2, i.next());
    }
View Full Code Here

        assertTrue(!i.hasPrevious());
        assertTrue(!i.hasNext());
        i.add(d1);
        assertTrue(i.hasPrevious());
        assertTrue(!i.hasNext());
        assertEquals(d1, i.previous());
        assertEquals(d1, i.next());
        assertEquals(d1, list.get(0));
    }

    @Test
View Full Code Here

    // TODO check ListIterator  implementation for JDK 1.1
      ListIterator iter = certificates.listIterator(certificates.size());
      while ( iter.hasPrevious() )
      {
        v.add(getEncodedX509Certificate((X509Certificate)iter.previous()));
      }

        encoded = new DERSequence(v);
  }
  else
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.