Package java.util

Examples of java.util.ArrayList.trimToSize()


                    .get(i) == objArray[i]);
        Vector v = new Vector();
        v.add("a");
        ArrayList al = new ArrayList(v);
        Iterator it = al.iterator();
        al.trimToSize();
        try {
            it.next();
            fail("should throw a ConcurrentModificationException");
        } catch (ConcurrentModificationException ioobe) {
            // expected
View Full Code Here


        if(expirationLogger.isLoggable(Level.FINEST)) {
            expirationLogger.log(Level.FINEST, "Iterator notified");
        }
       
  // Compact the collection, if possible
  events.trimToSize();
        if (operationsLogger.isLoggable(Level.FINER)) {
      operationsLogger.exiting(mailboxSourceClass,
          "getRemoteEventsDo", events);
  }
       
View Full Code Here

                    "Trouble accessing remote event(s) - skipping", cnfe);
            }
        }

  // Compact the collection, if possible
  events.trimToSize();
        if (operationsLogger.isLoggable(Level.FINER)) {
      operationsLogger.exiting(mailboxSourceClass,
          "getNextBatchDo", events);
  }
        return events;
View Full Code Here

    public void trimToSize() {

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

              NamingEnumeration attributeValues = attribute.getAll();
              while (attributeValues.hasMore()) {
                  Object attrValue = attributeValues.next();
                  attributeValueList.add(getHeaderValueAsString(attrValue));
              }
              attributeValueList.trimToSize(); // should be a no-op if attribute.size() didn't lie
              headerFields.put(attributeID, Collections.unmodifiableList(attributeValueList));
          }
      } catch (NamingException ne) {
            // Shouldn't happen
      }
View Full Code Here

                    .get(i) == objArray[i]);
        Vector v = new Vector();
        v.add("a");
        ArrayList al = new ArrayList(v);
        Iterator it = al.iterator();
        al.trimToSize();
        try {
            it.next();
            fail("should throw a ConcurrentModificationException");
        } catch (ConcurrentModificationException ioobe) {
            // expected
View Full Code Here

                str = new StringBuffer();
            else
                minCapacity--;
        }

        output.trimToSize();
        Object[] outputObj = output.toArray();
        String[] outputStr = new String[output.size()];
        for (int i=0; i<output.size(); i++)
            outputStr[i] = new String((String) outputObj[i]);
        return outputStr;
View Full Code Here

                str = new StringBuffer();
            else
                minCapacity--;
        }

        output.trimToSize();
        Object[] outputObj = output.toArray();
        String[] outputStr = new String[output.size()];
        for (int i=0; i<output.size(); i++)
            outputStr[i] = new String((String) outputObj[i]);
        return outputStr;
View Full Code Here

                str = new StringBuffer();
            else
                minCapacity--;
        }

        output.trimToSize();
        Object[] outputObj = output.toArray();
        String[] outputStr = new String[output.size()];
        for (int i=0; i<output.size(); i++)
            outputStr[i] = new String((String) outputObj[i]);
        return outputStr;
View Full Code Here

                str = new StringBuffer();
            else
                minCapacity--;
        }

        output.trimToSize();
        Object[] outputObj = output.toArray();
        String[] outputStr = new String[output.size()];
        for (int i=0; i<output.size(); i++)
            outputStr[i] = new String((String) outputObj[i]);
        return outputStr;
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.