Package java.util

Examples of java.util.ArrayList.trimToSize()


        while ((tempElement = decodeInputStream(dbis, nesting+1, internKeys)) != null) {
            //add the element
          tempList.add(tempElement);
        }

        tempList.trimToSize();
        dbis.mark(Integer.MAX_VALUE);
        tempByte = dbis.read();
        dbis.reset();
        if ( nesting > 0 && tempByte == -1 ){
View Full Code Here


        while (it.hasNext()) {
            Object o = it.next();
            if (set.add(o))
                ulist.add(o);
        }
        ulist.trimToSize();
        return ulist;
    }

    private static final Map createOperations()
    {
View Full Code Here

    public SimpleSequence(TemplateCollectionModel tcm) throws TemplateModelException {
        ArrayList alist = new ArrayList();
        for (TemplateModelIterator it = tcm.iterator(); it.hasNext();) {
            alist.add(it.next());
        }
        alist.trimToSize();
        list = alist;
    }

    /**
     * Constructs an empty simple sequence using the specified object wrapper.
View Full Code Here

  IJavaElement parent = element.getParent();
  while (parent != null) {
    parents.add(parent);
    parent = parent.getParent();
  }
  parents.trimToSize();
  return parents;
}
/**
* @see IRegion
*/
 
View Full Code Here

    parent = parent.getParent();
    if (parent == null) {
      return null;
    }
  }
  parents.trimToSize();
  return parents;
}
public CompilationUnit getCompilationUnitAST() {
  return this.ast;
}
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

          .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

    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

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.