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

      if (fciTargets instanceof ArrayList)
      {
         ArrayList fciArrayList = (ArrayList) fciTargets;
         try
         {
            fciArrayList.ensureCapacity(5);
            fail("ensureCapacity call did not fail");
         }
         catch (UnsupportedOperationException good) {}
        
         try
View Full Code Here

      if (fciTargets instanceof ArrayList)
      {
         ArrayList fciArrayList = (ArrayList) fciTargets;
         try
         {
            fciArrayList.ensureCapacity(5);
            fail("ensureCapacity call did not fail");
         }
         catch (UnsupportedOperationException good) {}
        
         try
View Full Code Here

  }

  @Override
  public Object resize(final Object list, final int newSize) {
    final ArrayList l = (ArrayList) list;
    l.ensureCapacity(newSize);
    while (l.size() < newSize) {
      l.add(null);
    }
    while (l.size() > newSize) {
      l.remove(l.size() - 1);
View Full Code Here

                           SOAPUnmarshaller unmsh) throws SOAPUnmarshallerException
      {
         ArrayList list = getList(nObj, m_nOrdinal, ((XMLUnmarshaller)unmsh));

         // add empty positions
         for(list.ensureCapacity(nCookie + 1); list.size() <= nCookie; list.add(null));

         list.set(nCookie, value);
      }

      /**
 
View Full Code Here

        Connection conn = DriverManager.getConnection("jdbc:derby:wombat;create=true");
        conn.close();
        conn = null;
       
        ArrayList list = new ArrayList();
        list.ensureCapacity(30000);
       
        Properties p = new Properties();
       
        while (true) {
            Connection c;
View Full Code Here

       
        System.out.println("");
       
        System.out.println(list.size() + " successful connections");
       
        list.ensureCapacity(list.size() + 500);
       
        // try to make 500 more connection requests.
        int fail_sqloome = 0;
        int fail_sql = 0;
        int fail_bad = 0;
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

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.