Package java.util

Examples of java.util.Vector.capacity()


  public void test_ensureCapacityI() {
    // Test for method void java.util.Vector.ensureCapacity(int)

    Vector v = new Vector(9);
    v.ensureCapacity(20);
    assertEquals("ensureCapacity failed to set correct capacity", 20, v
        .capacity());
    v = new Vector(100);
    assertEquals("ensureCapacity reduced capacity", 100, v.capacity());
       
        v.ensureCapacity(150);
View Full Code Here


    Vector v = new Vector(9);
    v.ensureCapacity(20);
    assertEquals("ensureCapacity failed to set correct capacity", 20, v
        .capacity());
    v = new Vector(100);
    assertEquals("ensureCapacity reduced capacity", 100, v.capacity());
       
        v.ensureCapacity(150);
        assertEquals(
                "ensuieCapacity failed to set to be twice the old capacity",
                200, v.capacity());
View Full Code Here

    assertEquals("ensureCapacity reduced capacity", 100, v.capacity());
       
        v.ensureCapacity(150);
        assertEquals(
                "ensuieCapacity failed to set to be twice the old capacity",
                200, v.capacity());

        v = new Vector(9, -1);
        v.ensureCapacity(20);
        assertEquals("ensureCapacity failed to set to be minCapacity", 20, v
                .capacity());
View Full Code Here

                "ensuieCapacity failed to set to be twice the old capacity",
                200, v.capacity());

        v = new Vector(9, -1);
        v.ensureCapacity(20);
        assertEquals("ensureCapacity failed to set to be minCapacity", 20, v
                .capacity());
        v.ensureCapacity(15);
        assertEquals("ensureCapacity reduced capacity", 20, v.capacity());
        v.ensureCapacity(35);
        assertEquals(
View Full Code Here

        v = new Vector(9, -1);
        v.ensureCapacity(20);
        assertEquals("ensureCapacity failed to set to be minCapacity", 20, v
                .capacity());
        v.ensureCapacity(15);
        assertEquals("ensureCapacity reduced capacity", 20, v.capacity());
        v.ensureCapacity(35);
        assertEquals(
                "ensuieCapacity failed to set to be twice the old capacity",
                40, v.capacity());
View Full Code Here

        v.ensureCapacity(15);
        assertEquals("ensureCapacity reduced capacity", 20, v.capacity());
        v.ensureCapacity(35);
        assertEquals(
                "ensuieCapacity failed to set to be twice the old capacity",
                40, v.capacity());

        v = new Vector(9, 4);
        v.ensureCapacity(11);
        assertEquals("ensureCapacity failed to set correct capacity", 13, v
                .capacity());
View Full Code Here

                "ensuieCapacity failed to set to be twice the old capacity",
                40, v.capacity());

        v = new Vector(9, 4);
        v.ensureCapacity(11);
        assertEquals("ensureCapacity failed to set correct capacity", 13, v
                .capacity());
        v.ensureCapacity(5);
        assertEquals("ensureCapacity reduced capacity", 13, v.capacity());
        v.ensureCapacity(20);
        assertEquals(
View Full Code Here

        v = new Vector(9, 4);
        v.ensureCapacity(11);
        assertEquals("ensureCapacity failed to set correct capacity", 13, v
                .capacity());
        v.ensureCapacity(5);
        assertEquals("ensureCapacity reduced capacity", 13, v.capacity());
        v.ensureCapacity(20);
        assertEquals(
                "ensuieCapacity failed to set to be twice the old capacity",
                20, v.capacity());
  }
View Full Code Here

        v.ensureCapacity(5);
        assertEquals("ensureCapacity reduced capacity", 13, v.capacity());
        v.ensureCapacity(20);
        assertEquals(
                "ensuieCapacity failed to set to be twice the old capacity",
                20, v.capacity());
  }

  /**
   * @tests java.util.Vector#equals(java.lang.Object)
   */
 
View Full Code Here

  public void test_trimToSize() {
    // Test for method void java.util.Vector.trimToSize()
    Vector v = new Vector(10);
    v.addElement(new Object());
    v.trimToSize();
    assertEquals("Failed to trim capacity", 1, v.capacity());
  }

  protected Vector vectorClone(Vector s) {
    return (Vector) s.clone();
  }
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.