Package java.util

Examples of java.util.ArrayList.ensureCapacity()


    try {
      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));
    } catch (Exception e) {
      fail("Exception during test : " + e.getMessage());
    }
View Full Code Here

    private void initializePositions() {
        ArrayList matchResultPositions = new ArrayList();

        // FULL MATCH
        int posIndex = 0;
        matchResultPositions.ensureCapacity(posIndex + 1);
        matchResultPositions.add(posIndex, null);

        Iterator i;

        TERM_STEP_REGEX_MODIFIER_POS = ++posIndex;
View Full Code Here

        matchResultPositions.add(posIndex, null);

        Iterator i;

        TERM_STEP_REGEX_MODIFIER_POS = ++posIndex;
        matchResultPositions.ensureCapacity(posIndex + 1);
        matchResultPositions.add(TERM_STEP_REGEX_MODIFIER_POS, null);
        i = termsFactory.getModifiersCollection().iterator();
        while (i.hasNext()) {
            TermDefinition td = (TermDefinition) i.next();
            int size = td.getMatchSize() + 1;
View Full Code Here

        while (i.hasNext()) {
            TermDefinition td = (TermDefinition) i.next();
            int size = td.getMatchSize() + 1;
            for (int k = 0; k < size; k++) {
                posIndex++;
                matchResultPositions.ensureCapacity(posIndex + 1);
                matchResultPositions.add(posIndex, td);
            }
        }

        TERM_STEP_REGEX_QUALIFIER_POS = ++posIndex;
View Full Code Here

                matchResultPositions.add(posIndex, td);
            }
        }

        TERM_STEP_REGEX_QUALIFIER_POS = ++posIndex;
        matchResultPositions.ensureCapacity(posIndex + 1);
        matchResultPositions.add(posIndex, null);

        TERM_STEP_REGEX_MECHANISM_POS = ++posIndex;
        matchResultPositions.ensureCapacity(posIndex + 1);
        matchResultPositions.add(TERM_STEP_REGEX_MECHANISM_POS, null);
View Full Code Here

        TERM_STEP_REGEX_QUALIFIER_POS = ++posIndex;
        matchResultPositions.ensureCapacity(posIndex + 1);
        matchResultPositions.add(posIndex, null);

        TERM_STEP_REGEX_MECHANISM_POS = ++posIndex;
        matchResultPositions.ensureCapacity(posIndex + 1);
        matchResultPositions.add(TERM_STEP_REGEX_MECHANISM_POS, null);
        i = termsFactory.getMechanismsCollection().iterator();
        while (i.hasNext()) {
            TermDefinition td = (TermDefinition) i.next();
            int size = td.getMatchSize() + 1;
View Full Code Here

        while (i.hasNext()) {
            TermDefinition td = (TermDefinition) i.next();
            int size = td.getMatchSize() + 1;
            for (int k = 0; k < size; k++) {
                posIndex++;
                matchResultPositions.ensureCapacity(posIndex + 1);
                matchResultPositions.add(posIndex, td);
            }
        }

        if (log.isDebugEnabled()) {
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

      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

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.