Package java.util

Examples of java.util.ArrayList.ensureCapacity()


    int location = al.indexOf(testObject);
                al.ensureCapacity(capacity);
                assertTrue("EnsureCapacity moved objects around in array1.",
                                location == al.indexOf(testObject));
                al.remove(0);
                al.ensureCapacity(capacity);
                assertTrue("EnsureCapacity moved objects around in array2.",
                                --location == al.indexOf(testObject));
                al.ensureCapacity(capacity + 2);
                assertTrue("EnsureCapacity did not change location.",
                                location == al.indexOf(testObject));
View Full Code Here


                                location == al.indexOf(testObject));
                al.remove(0);
                al.ensureCapacity(capacity);
                assertTrue("EnsureCapacity moved objects around in array2.",
                                --location == al.indexOf(testObject));
                al.ensureCapacity(capacity + 2);
                assertTrue("EnsureCapacity did not change location.",
                                location == al.indexOf(testObject));
  }

  /**
 
View Full Code Here

    for (i = 0; i < capacity / 2; i++) {
      al.add(i, new Object());
    }
    al.add(i, testObject);
    int location = al.indexOf(testObject);
                al.ensureCapacity(capacity);
                assertTrue("EnsureCapacity moved objects around in array1.",
                                location == al.indexOf(testObject));
                al.remove(0);
                al.ensureCapacity(capacity);
                assertTrue("EnsureCapacity moved objects around in array2.",
View Full Code Here

    int location = al.indexOf(testObject);
                al.ensureCapacity(capacity);
                assertTrue("EnsureCapacity moved objects around in array1.",
                                location == al.indexOf(testObject));
                al.remove(0);
                al.ensureCapacity(capacity);
                assertTrue("EnsureCapacity moved objects around in array2.",
                                --location == al.indexOf(testObject));
                al.ensureCapacity(capacity + 2);
                assertTrue("EnsureCapacity did not change location.",
                                location == al.indexOf(testObject));
View Full Code Here

                                location == al.indexOf(testObject));
                al.remove(0);
                al.ensureCapacity(capacity);
                assertTrue("EnsureCapacity moved objects around in array2.",
                                --location == al.indexOf(testObject));
                al.ensureCapacity(capacity + 2);
                assertTrue("EnsureCapacity did not change location.",
                                location == al.indexOf(testObject));
  }

  /**
 
View Full Code Here

    for (i = 0; i < capacity / 2; i++) {
      al.add(i, new Object());
    }
    al.add(i, testObject);
    int location = al.indexOf(testObject);
                al.ensureCapacity(capacity);
                assertTrue("EnsureCapacity moved objects around in array1.",
                                location == al.indexOf(testObject));
                al.remove(0);
                al.ensureCapacity(capacity);
                assertTrue("EnsureCapacity moved objects around in array2.",
View Full Code Here

    int location = al.indexOf(testObject);
                al.ensureCapacity(capacity);
                assertTrue("EnsureCapacity moved objects around in array1.",
                                location == al.indexOf(testObject));
                al.remove(0);
                al.ensureCapacity(capacity);
                assertTrue("EnsureCapacity moved objects around in array2.",
                                --location == al.indexOf(testObject));
                al.ensureCapacity(capacity + 2);
                assertTrue("EnsureCapacity did not change location.",
                                location == al.indexOf(testObject));
View Full Code Here

                                location == al.indexOf(testObject));
                al.remove(0);
                al.ensureCapacity(capacity);
                assertTrue("EnsureCapacity moved objects around in array2.",
                                --location == al.indexOf(testObject));
                al.ensureCapacity(capacity + 2);
                assertTrue("EnsureCapacity did not change location.",
                                location == al.indexOf(testObject));
  }

  /**
 
View Full Code Here

    public void ensureCapacity(int capacity) {

        if (fast) {
            synchronized (this) {
                ArrayList temp = (ArrayList) list.clone();
                temp.ensureCapacity(capacity);
                list = temp;
            }
        } else {
            synchronized (list) {
                list.ensureCapacity(capacity);
View Full Code Here

        for (i = 0; i < capacity / 2; i++) {
            al.add(i, new Object());
        }
        al.add(i, testObject);
        int location = al.indexOf(testObject);
        al.ensureCapacity(capacity);
        assertTrue("EnsureCapacity moved objects around in array1.",
                location == al.indexOf(testObject));
        al.remove(0);
        al.ensureCapacity(capacity);
        assertTrue("EnsureCapacity moved objects around in array2.",
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.