java.util.Vector.insertElementAt()方法的使用及代码示例

x33g5p2x  于2022-01-31 转载在 其他  
字(6.9k)|赞(0)|评价(0)|浏览(110)

本文整理了Java中java.util.Vector.insertElementAt()方法的一些代码示例,展示了Vector.insertElementAt()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Vector.insertElementAt()方法的具体详情如下:
包路径:java.util.Vector
类名称:Vector
方法名:insertElementAt

Vector.insertElementAt介绍

[英]Inserts the specified object into this vector at the specified location. This object is inserted before any previous element at the specified location. All elements with an index equal or greater than location have their index increased by 1. If the location is equal to the size of this vector, the object is added at the end.
[中]在指定位置将指定对象插入该向量。该对象插入到指定位置的任何前一个元素之前。索引等于或大于位置的所有元素的索引都会增加1。如果位置等于该向量的大小,则对象将添加到末尾。

代码示例

代码示例来源:origin: robovm/robovm

/**
 * Adds the specified object into this vector at the specified location. The
 * object is inserted before any element with the same or a higher index
 * increasing their index by 1. If the location is equal to the size of this
 * vector, the object is added at the end.
 *
 * @param location
 *            the index at which to insert the element.
 * @param object
 *            the object to insert in this vector.
 * @throws ArrayIndexOutOfBoundsException
 *                if {@code location < 0 || location > size()}.
 * @see #addElement
 * @see #size
 */
@Override
public void add(int location, E object) {
  insertElementAt(object, location);
}

代码示例来源:origin: xalan/xalan

/**
 * Set the first attribute of this element
 */
public void setFirstAttribute(SyntaxTreeNode attribute) {
if (_attributeElements == null) {
  _attributeElements = new Vector(2);
}
_attributeElements.insertElementAt(attribute,0);
}

代码示例来源:origin: org.codehaus.plexus/plexus-utils

/**
 * Adds an argument object to our list of args.
 *
 * @param insertAtStart if true, the argument is inserted at the beginning of the list of args, otherwise it is
 *            appended.
 */
public void addArg( Arg argument, boolean insertAtStart )
{
  if ( insertAtStart )
  {
    arguments.insertElementAt( argument, 0 );
  }
  else
  {
    arguments.addElement( argument );
  }
}

代码示例来源:origin: stackoverflow.com

Stack<String> stack = new Stack<String>();
 stack.push("1");
 stack.push("2");
 stack.push("3");
 stack.insertElementAt("squeeze me in!", 1);
 while (!stack.isEmpty()) {
   System.out.println(stack.pop());
 }
 // prints "3", "2", "squeeze me in!", "1"

代码示例来源:origin: xalan/xalan

/**
 * Inserts the first child node of this syntax tree node. The existing
 * children are shifted back one position.
 * @param element is the new child node.
 */
protected final void setFirstElement(SyntaxTreeNode element) {
_contents.insertElementAt(element,0);
element.setParent(this);
}

代码示例来源:origin: org.codehaus.plexus/plexus-utils

/**
 * <p>Creates an argument object and adds it to our list of args.</p>
 * 
 * <p>Each commandline object has at most one instance of the argument class.</p>
 *
 * @param insertAtStart if true, the argument is inserted at the beginning of the list of args, otherwise it is
 *            appended.
 * @deprecated Use {@link Commandline#createArg(boolean)} instead
 */
public Argument createArgument( boolean insertAtStart )
{
  Argument argument = new Argument();
  if ( insertAtStart )
  {
    arguments.insertElementAt( argument, 0 );
  }
  else
  {
    arguments.addElement( argument );
  }
  return argument;
}

代码示例来源:origin: org.codehaus.plexus/plexus-utils

/**
 * <p>Creates an argument object and adds it to our list of args.</p>
 * 
 * <p>Each commandline object has at most one instance of the argument class.</p>
 *
 * @param insertAtStart if true, the argument is inserted at the beginning of the list of args, otherwise it is
 *            appended.
 */
public Arg createArg( boolean insertAtStart )
{
  Arg argument = new Argument();
  if ( insertAtStart )
  {
    arguments.insertElementAt( argument, 0 );
  }
  else
  {
    arguments.addElement( argument );
  }
  return argument;
}

代码示例来源:origin: xalan/xalan

if (_separLast) _nSepars--;
if (_nSepars == 0) {
  _separToks.insertElementAt(".", 1);
  _nSepars++;

代码示例来源:origin: xalan/xalan

patterns.insertElementAt(pattern, i);
break;

代码示例来源:origin: robovm/robovm

b.insertElementAt(a.elementAt(i), i);
else
 b.setElementAt(a.elementAt(i), i);
 b.insertElementAt(a.elementAt(j), r + m + 1 - j);
else
 b.setElementAt(a.elementAt(j), r + m + 1 - j);

代码示例来源:origin: igniterealtime/Smack

rendList.insertElementAt(dar, 0);
PlugInManager.setPlugInList(rendList, plType);
PlugInManager.commit();

代码示例来源:origin: xalan/xalan

b.insertElementAt(a.elementAt(i), i);
else
 b.setElementAt(a.elementAt(i), i);
 b.insertElementAt(a.elementAt(j), r + m + 1 - j);
else
 b.setElementAt(a.elementAt(j), r + m + 1 - j);

代码示例来源:origin: org.apache.ant/ant

subNames.insertElementAt(targetName, pos);
if (printDependencies) {
  subDependencies.insertElementAt(currentTarget.getDependencies(), pos);
topNames.insertElementAt(targetName, pos);
topDescriptions.insertElementAt(targetDescription, pos);
if (targetName.length() > maxLength) {
  maxLength = targetName.length();
  topDependencies.insertElementAt(currentTarget.getDependencies(), pos);

代码示例来源:origin: igniterealtime/Smack

if (rendList.elementAt(listSize - 1).equals(dar)) {
  rendList.removeElementAt(listSize - 1);
  rendList.insertElementAt(dar, 0);
  PlugInManager.setPlugInList(rendList, plType);
  PlugInManager.commit();

代码示例来源:origin: postgresql/postgresql

rows.insertElementAt(this_row, 0);
current_row = 0;

代码示例来源:origin: plantuml/plantuml

/**
 * Inserts a {@link DataElement} at the specified index. 
 * After the element has been successfully inserted
 * all {@link DataListener DataListeners} will be informed.
 * @param index Index at which <tt>element</tt> will be inserted.
 *        All elements with an index &gt;= <tt>index</tt> will be shifted.
 * @param element DataElement to be added.
 * @throws IllegalArgumentException if <tt>element</tt> is not of the correct
 *         type which will be checked by the method {@link #isValid}.
 */
public void insertElementAt(int index, DataElement element) {
 if (isValid(element)) {
  _container.insertElementAt(element, index);
  element.setContainer(this);
  notifyListeners(DataEvent.createInsertEvent(this, index));
 } else {
  throwException(INSERT, element);
 }
}

代码示例来源:origin: xalan/xalan

int arglright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right;
Vector argl = (Vector)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).value;
 argl.insertElementAt(arg, 0); RESULT = argl; 
   CUP$XPathParser$result = new java_cup.runtime.Symbol(36/*NonemptyArgumentList*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-2)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT);
int ppright = ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right;
Vector pp = (Vector)((java_cup.runtime.Symbol) CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).value;
 pp.insertElementAt(p, 0); RESULT = pp; 
   CUP$XPathParser$result = new java_cup.runtime.Symbol(35/*Predicates*/, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-1)).left, ((java_cup.runtime.Symbol)CUP$XPathParser$stack.elementAt(CUP$XPathParser$top-0)).right, RESULT);

代码示例来源:origin: org.apache.ant/ant

destDir = savedDestDir;
if (savedRc != null) {
  rcs.insertElementAt(savedRc, 0);

代码示例来源:origin: wsdl4j/wsdl4j

private static Vector getVectorPathFromNode(Node node)
{
 Vector path = new Vector();
 while (node != null)
 {
  path.insertElementAt(node, 0);
  node = node.getParentNode();
 }
 return path;
}

代码示例来源:origin: i2p/i2p.i2p

void insertFrame(int index, Gif89Frame gf) throws IOException {
  accommodateFrame(gf);
  vFrames.insertElementAt(gf, index);
}

相关文章

微信公众号

最新文章

更多