本文整理了Java中java.util.Vector.ensureCapacity()
方法的一些代码示例,展示了Vector.ensureCapacity()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Vector.ensureCapacity()
方法的具体详情如下:
包路径:java.util.Vector
类名称:Vector
方法名:ensureCapacity
[英]Ensures that this vector can hold the specified number of elements without growing.
[中]确保此向量可以容纳指定数量的元素,而不会增长。
代码示例来源:origin: robovm/robovm
/**
* Sets the size of this vector to the specified size. If there are more
* than length elements in this vector, the elements at end are lost. If
* there are less than length elements in the vector, the additional
* elements contain null.
*
* @param length
* the new size of this vector.
* @see #size
*/
public synchronized void setSize(int length) {
if (length == elementCount) {
return;
}
ensureCapacity(length);
if (elementCount > length) {
Arrays.fill(elementData, length, elementCount, null);
}
elementCount = length;
modCount++;
}
代码示例来源:origin: Sable/soot
block.succ.ensureCapacity(block.succ.size() + branches.length);
代码示例来源:origin: brianfrankcooper/YCSB
result.ensureCapacity(recordcount);
代码示例来源:origin: brianfrankcooper/YCSB
result.ensureCapacity(recordcount);
代码示例来源:origin: org.netbeans.api/org-openide-awt
public Manager() {
hasBeenDone = true;
alive = true;
inProgress = true;
// Already done: edits = new Vector<UndoableEdit>();
indexOfNextAdd = 0;
limit = 100;
edits.ensureCapacity(limit);
}
代码示例来源:origin: brianfrankcooper/YCSB
result.ensureCapacity(recordcount);
代码示例来源:origin: net.java.abeille/abeille
/**
* ctor
*/
public EditorUndoManager(AbstractFormManager formmgr, FormEditor editor) {
m_formmgr = formmgr;
m_editor = editor;
m_indexOfNextAdd = 0;
m_limit = 100;
edits.ensureCapacity(m_limit);
}
代码示例来源:origin: net.sf.jt400/jt400
void add(int[] values)
{
v.ensureCapacity(v.size() + values.length);
for (int i=0; i < values.length; i++)
{
v.addElement(new Integer(values[i]));
}
}
代码示例来源:origin: javax.mail/com.springsource.javax.mail
/**
* append the given Argument to this Argument. All items
* from the source argument are copied into this destination
* argument.
*/
public void append(Argument arg) {
items.ensureCapacity(items.size() + arg.items.size());
for (int i=0; i < arg.items.size(); i++)
items.addElement(arg.items.elementAt(i));
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.javax.mail
/**
* append the given Argument to this Argument. All items
* from the source argument are copied into this destination
* argument.
*/
public void append(Argument arg) {
items.ensureCapacity(items.size() + arg.items.size());
for (int i=0; i < arg.items.size(); i++)
items.addElement(arg.items.elementAt(i));
}
代码示例来源:origin: com.haulmont.thirdparty/eclipselink
/**
* @see java.util.Vector#ensureCapacity(int)
*/
@Override
public void ensureCapacity(int minCapacity) {
getDelegate().ensureCapacity(minCapacity);
}
代码示例来源:origin: org.apache.ant/ant-junit
/**
* Convenient method to merge the <tt>JUnitTest</tt>s of this batchtest
* to a <tt>Vector</tt>.
* @param v the vector to which should be added all individual tests of this
* batch test.
*/
void addTestsTo(Vector<? super JUnitTest> v) {
JUnitTest[] tests = createAllJUnitTest();
v.ensureCapacity(v.size() + tests.length);
for (JUnitTest test : tests) {
v.addElement(test);
}
}
代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.core
/**
* @see java.util.Vector#ensureCapacity(int)
*/
@Override
public void ensureCapacity(int minCapacity) {
getDelegate().ensureCapacity(minCapacity);
}
代码示例来源:origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence
/**
* @see java.util.Vector#ensureCapacity(int)
*/
public void ensureCapacity(int minCapacity) {
getDelegate().ensureCapacity(minCapacity);
}
代码示例来源:origin: timewalker74/ffmq
@Override
protected void unserializeBodyFrom(RawDataBuffer in)
{
int size = in.readInt();
body.ensureCapacity(size);
for (int n = 0 ; n < size ; n++)
{
Object value = in.readGeneric();
body.add(value);
}
}
代码示例来源:origin: org.apache.openejb.patch/openjpa
public synchronized void ensureCapacity(int minCapacity) {
if (!_directAccess && isDelayLoad()) {
load();
}
super.ensureCapacity(minCapacity);
}
代码示例来源:origin: org.apache.openjpa/openjpa-all
public synchronized void ensureCapacity(int minCapacity) {
if (!_directAccess && isDelayLoad()) {
load();
}
super.ensureCapacity(minCapacity);
}
代码示例来源:origin: org.apache.openjpa/openjpa-kernel
public synchronized void ensureCapacity(int minCapacity) {
if (!_directAccess && isDelayLoad()) {
load();
}
super.ensureCapacity(minCapacity);
}
代码示例来源:origin: net.sf.jt400/jt400
void add(PcmlDimensions values)
{
v.ensureCapacity(v.size() + values.size());
for (int i=0; i < values.size(); i++)
{
v.addElement(values.integerAt(i));
}
}
代码示例来源:origin: octo-online/reactive-audit
@Test(expected = ReactiveAuditException.class)
public void ensureCapacity()
{
ReactiveAudit.off.commit();
Vector vector=new Vector();
TestTools.strict.commit();
vector.ensureCapacity(0);
}
@Test(expected = ReactiveAuditException.class)
内容来源于网络,如有侵权,请联系作者删除!