Examples of ensureCapacity()


Examples of com.mongodb.BasicDBList.ensureCapacity()

      element.put(prefix + "Name", ((NamedVector)vec).getName());
    }
    BasicDBList dbl2 = new BasicDBList();
    if (vec.isDense()) {
      int nSize = vec.size();
      dbl2.ensureCapacity(nSize);
      for (int i = 0; i < nSize; ++i) {
        dbl2.add(vec.getQuick(i));           
      }
    }
    else { // sparse, write as a set in the format [{int:double}]
View Full Code Here

Examples of gnu.trove.set.hash.TIntHashSet.ensureCapacity()

            shuffle(indicesSpace[b]);
        }

        TIntHashSet forbidden = new TIntHashSet();
        for (int[] sp : indicesSpace) {
            forbidden.ensureCapacity(sp.length);
            forbidden.addAll(IndicesUtils.getIndicesNames(sp));
        }

        //Creating resulting product
        ProductBuilder pb = new ProductBuilder(10, avrProductSize);
View Full Code Here

Examples of it.unimi.dsi.fastutil.ints.IntArrayList.ensureCapacity()

        final int overlapEnd = overlap.getStop();
        for (int s = 0; s < sampleCount; s++) {
            buffer.clear();
            final GATKSAMRecord[] sampleReads = readsBySampleIndex[s];
            final int sampleReadCount = sampleReads.length;
            buffer.ensureCapacity(sampleReadCount);
            for (int r = 0; r < sampleReadCount; r++)
                if (unclippedReadOverlapsRegion(sampleReads[r], referenceIndex, overlapStart, overlapEnd))
                    buffer.add(r);
            result[s] = buffer.toIntArray();
        }
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()

    }

    ArrayList currentParameters = (ArrayList)parameters.get(parameters.size()-1);
    if ( currentParameters!=null) {
      if ( currentParameters.size()<=paramIndex) {
        currentParameters.ensureCapacity(paramIndex+1);
        for ( int i = currentParameters.size(); i < paramIndex; i++) currentParameters.add(i,null);
          currentParameters.add(paramIndex,parameter);
      } else {
        currentParameters.set(paramIndex,parameter);
      }
View Full Code Here

Examples of java.util.ArrayList.ensureCapacity()

      List<Attribute> list = attributeList();

      if (list instanceof ArrayList) {
        ArrayList arrayList = (ArrayList) list;

        arrayList.ensureCapacity(minCapacity);
      }
    }
  }

  // Implementation methods
View Full Code Here

Examples of java.util.ArrayList.ensureCapacity()

    if ( reader == null ) return null;
    ArrayList result = new ArrayList();
    try {
      char[] charbuf = new char[BUFFER_SIZE];
      for ( int i = reader.read( charbuf ); i > 0 ; i = reader.read( charbuf ) ) {
        result.ensureCapacity( result.size() + BUFFER_SIZE );
        for ( int charIndex = 0; charIndex < i ; charIndex++ ) {
          result.add( Character.valueOf( charbuf[charIndex] ) );
        }
      }
    }
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 ( reader == null ) return null;
    ArrayList result = new ArrayList();
    try {
      char[] charbuf = new char[BUFFER_SIZE];
      for ( int i = reader.read( charbuf ); i > 0 ; i = reader.read( charbuf ) ) {
        result.ensureCapacity( result.size() + BUFFER_SIZE );
        for ( int charIndex = 0; charIndex < i ; charIndex++ ) {
          result.add( Character.valueOf( charbuf[charIndex] ) );
        }
      }
    }
View Full Code Here

Examples of java.util.ArrayList.ensureCapacity()

        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
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.