Examples of ensureCapacity()


Examples of java.util.ArrayList.ensureCapacity()

        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

Examples of java.util.ArrayList.ensureCapacity()

    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

Examples of java.util.ArrayList.ensureCapacity()

      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

Examples of java.util.ArrayList.ensureCapacity()

      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

Examples of java.util.ArrayList.ensureCapacity()

        if (index < 0)
        {
          throw new ParseException("Failed to parse array index", getLocator());
        }
       
        list.ensureCapacity(index);
        while (list.size() < (index + 1))
        {
          list.add(null);
        }
        list.set(index, ObjectConverterFactory.convert(componentType, value, getLocator()));
View Full Code Here

Examples of java.util.ArrayList.ensureCapacity()

    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

Examples of java.util.ArrayList.ensureCapacity()

     * @return A list of Token objects.
     */
    public List getHistory(int channel) {
        ArrayList result = new ArrayList();
        if (_records != null) {
            result.ensureCapacity(_records.size());
            Iterator firings = _records.iterator();
            while (firings.hasNext()) {
                Token[] record = (Token[])firings.next();
                if (channel < record.length) {
                    if (record[channel] != null) {
View Full Code Here

Examples of java.util.ArrayList.ensureCapacity()

    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

Examples of java.util.Stack.ensureCapacity()

    public synchronized Object borrowObject(Object key) throws Exception {
        assertOpen();
        Stack stack = (Stack)(_pools.get(key));
        if(null == stack) {
            stack = new Stack();
            stack.ensureCapacity( _initSleepingCapacity > _maxSleeping ? _maxSleeping : _initSleepingCapacity);
            _pools.put(key,stack);
        }
        Object obj = null;
        do {
            boolean newlyMade = false;
View Full Code Here

Examples of java.util.Stack.ensureCapacity()

        }

        Stack stack = (Stack)_pools.get(key);
        if(null == stack) {
            stack = new Stack();
            stack.ensureCapacity( _initSleepingCapacity > _maxSleeping ? _maxSleeping : _initSleepingCapacity);
            _pools.put(key,stack);
        }
        final int stackSize = stack.size();
        if (stackSize >= _maxSleeping) {
            final Object staleObj;
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.