Package java.util

Examples of java.util.AbstractList$SubAbstractList


    /**
     * Return all the header lines as a collection
     */
    public List getAllHeaderLines() {
        if(headerValueView==null)
            headerValueView = new AbstractList() {
                public Object get(int index) {
                    return ((hdr)headers.get(index)).line;
                }

                public int size() {
View Full Code Here


         */
        public List getAliases(final boolean ident, final boolean inner) {
            if (_ids == null)
                return Collections.EMPTY_LIST;

            return new AbstractList() {
                public int size() {
                    return (ident && _idents != null) ? _idents.size()
                        : _ids.size();
                }

View Full Code Here

  /*
   * Test method for 'java.util.AbstractList.subList(int, int)'
   */
  public void testGet() {
    AbstractList al = new ArrayList();
    Double one = new Double(1.0);
    Double two = new Double(2.0);
    Double three = new Double(3.0);
    Double four = new Double(4.0);
    al.add(one);
    al.add(two);
    al.add(three);
    al.add(four);
    List sub = al.subList(1, 3);
    assertEquals(2, sub.size());
    // the sub.get(1) is 3.0
    assertTrue(((Double) sub.get(1)).doubleValue() <= 3.0);
    assertTrue(((Double) sub.get(1)).doubleValue() > 2.0);

    al.remove(1); // remove the 2.0

    try {
      // illegal call the subList's method get(int).
      sub.get(1);
      fail("It should throws ConcurrentModificationException.");
View Full Code Here

  /*
   * Test method for 'java.util.AbstractList.subList(int, int)'
   */
  public void testSet() {
    AbstractList al = new ArrayList();
    Double one = new Double(1.0);
    Double two = new Double(2.0);
    Double three = new Double(3.0);
    Double four = new Double(4.0);
    al.add(one);
    al.add(two);
    al.add(three);
    al.add(four);
    List sub = al.subList(1, 3);
    assertEquals(2, sub.size());
    // the sub.get(1) is 3.0
    assertTrue(((Double) sub.get(1)).doubleValue() <= 3.0);
    assertTrue(((Double) sub.get(1)).doubleValue() > 2.0);

    al.remove(1); // remove the 2.0

    try {
      // illegal call the subList's method set(int,Object).
      sub.set(1, two);
      fail("It should throws ConcurrentModificationException.");
View Full Code Here

  /*
   * Test method for 'java.util.AbstractList.subList(int, int)'
   */
  public void testAdd() {
    AbstractList al = new ArrayList();
    Double one = new Double(1.0);
    Double two = new Double(2.0);
    Double three = new Double(3.0);
    Double four = new Double(4.0);
    al.add(one);
    al.add(two);
    al.add(three);
    al.add(four);
    List sub = al.subList(1, 3);
    assertEquals(2, sub.size());
    // the sub.get(1) is 3.0
    assertTrue(((Double) sub.get(1)).doubleValue() <= 3.0);
    assertTrue(((Double) sub.get(1)).doubleValue() > 2.0);

    al.remove(1); // remove the 2.0

    try {
      // illegal call the subList's method Add(int,Object).
      sub.add(1, two);
      fail("It should throws ConcurrentModificationException.");
View Full Code Here

  /*
   * Test method for 'java.util.AbstractList.subList(int, int)'
   */
  public void testRemove() {
    AbstractList al = new ArrayList();
    Double one = new Double(1.0);
    Double two = new Double(2.0);
    Double three = new Double(3.0);
    Double four = new Double(4.0);
    al.add(one);
    al.add(two);
    al.add(three);
    al.add(four);
    List sub = al.subList(1, 3);
    assertEquals(2, sub.size());
    // the sub.get(1) is 3.0
    assertTrue(((Double) sub.get(1)).doubleValue() <= 3.0);
    assertTrue(((Double) sub.get(1)).doubleValue() > 2.0);

    al.remove(1); // remove the 2.0

    try {
      // illegal call the subList's method remove(int).
      sub.remove(1);
      fail("It should throws ConcurrentModificationException.");
View Full Code Here

  /*
   * Test method for 'java.util.AbstractList.subList(int, int)'
   */
  public void testAddAll() {
    AbstractList al = new ArrayList();
    Double one = new Double(1.0);
    Double two = new Double(2.0);
    Double three = new Double(3.0);
    Double four = new Double(4.0);
    al.add(one);
    al.add(two);
    al.add(three);
    al.add(four);
    List sub = al.subList(1, 3);
    assertEquals(2, sub.size());
    // the sub.get(1) is 3.0
    assertTrue(((Double) sub.get(1)).doubleValue() <= 3.0);
    assertTrue(((Double) sub.get(1)).doubleValue() > 2.0);

    al.remove(1); // remove the 2.0

    try {
      // illegal call the subList's method addAll(int,Collection).
      Collection c = new Vector();
      Double five = new Double(5.0);
View Full Code Here

        assertNotNull(list);
        assertTrue(list instanceof Serializable);
    }
   
    public void testWrapNonSerializable() {
        FloatList list = ListFloatList.wrap(new AbstractList() {
            public Object get(int i) { throw new IndexOutOfBoundsException(); }
            public int size() { return 0; }
        });
        assertNotNull(list);
        assertTrue(!(list instanceof Serializable));
View Full Code Here

        assertNotNull(list);
        assertTrue(list instanceof Serializable);
    }
   
    public void testWrapNonSerializable() {
        IntList list = ListIntList.wrap(new AbstractList() {
            public Object get(int i) { throw new IndexOutOfBoundsException(); }
            public int size() { return 0; }
        });
        assertNotNull(list);
        assertTrue(!(list instanceof Serializable));
View Full Code Here

        assertNotNull(list);
        assertTrue(list instanceof Serializable);
    }
   
    public void testWrapNonSerializable() {
        CharList list = ListCharList.wrap(new AbstractList() {
            public Object get(int i) { throw new IndexOutOfBoundsException(); }
            public int size() { return 0; }
        });
        assertNotNull(list);
        assertTrue(!(list instanceof Serializable));
View Full Code Here

TOP

Related Classes of java.util.AbstractList$SubAbstractList

Copyright © 2018 www.massapicom. 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.