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

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

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

Vector.elementAt介绍

[英]Returns the element at the specified location in this vector.
[中]返回此向量中指定位置的元素。

代码示例

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

public String[] toStringArray() {
 int len = v.size();
 String[] sa = new String[len];
 for(int i = 0; i < len; i++) {
  sa[i] = (String) v.elementAt(i);
 }
 return sa;
}

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

public FlowList append(FlowList right) {
if (_elements == null) {
  _elements = right._elements;
}
else {
  final Vector temp = right._elements;
  if (temp != null) {
  final int n = temp.size();
  for (int i = 0; i < n; i++) {
    _elements.addElement(temp.elementAt(i));
  }
  }
}
return this;
}

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

/**
 * Return an array containing the names of all currently defined
 * configuration attributes.  If there are no such attributes, a zero
 * length array is returned.
 */
public String[] getAttributeNames() {
  Vector names = new Vector();
  Enumeration keys = attributes.keys();
  while (keys.hasMoreElements()) {
    names.addElement((String) keys.nextElement());
  }
  String results[] = new String[names.size()];
  for (int i = 0; i < results.length; i++) {
    results[i] = (String) names.elementAt(i);
  }
  return (results);
}

代码示例来源:origin: org.osgi/org.osgi.compendium

private static String[] split(String input, char sep, int limit) {
  Vector v = new Vector();
  boolean limited = (limit > 0);
  int applied = 0;
    else {
      ++applied;
      v.add(part.toString());
      part = new StringBuffer();
    ++index;
  v.add(part.toString());
  int last = v.size();
  if (0 == limit) {
    for (int j = v.size() - 1; j >= 0; --j) {
      String s = (String) v.elementAt(j);
      if ("".equals(s))
        --last;
    ret[i] = (String) v.elementAt(i);

代码示例来源:origin: apache/geode

/**
 * decode the class name of the given argument, or the class name if the argument is zero
 */
public String decodeClassName(int argNo) {
 int idx;
 if (classes == null) {
  classes = new Vector();
  idx = 0;
  while (idx >= 0)
   idx = decodeNextClassName(idx);
 }
 if (argNo == 0)
  return (String) classes.elementAt(classes.size() - 1);
 else
  return (String) classes.elementAt(argNo - 1);
}

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

Vector nodes = new Vector();
 nodes.addElement(elem);
Vector scratchVector = new Vector();
 v.setItem(((NodeCompareElem) nodes.elementAt(i)).m_node, i);

代码示例来源:origin: stanfordnlp/CoreNLP

public static String[] byteArrToUStringArr(byte[] b) {
 int off = 0;
 Vector<String> v = new Vector<>();
 while (off < b.length) {
  int length = byteArrToInt(b, off);
  if (length != 0) {
   v.addElement(byteArrToUString(b, off + 4, length));
  } else {
   v.addElement("");
  }
  off = off + 2 * length + 4;
 }
 String[] s = new String[v.size()];
 for (int i = 0; i < s.length; i++) {
  s[i] = v.elementAt(i);
 }
 return s;
}

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

public Vector getAllValidTemplates() {
  // Return templates if no imported/included stylesheets
  if (_includedStylesheets == null) {
    return _templates;
  }
  
  // Is returned value cached?
  if (_allValidTemplates == null) {
    Vector templates = new Vector();
    int size = _includedStylesheets.size();
    for (int i = 0; i < size; i++) {
      Stylesheet included =(Stylesheet)_includedStylesheets.elementAt(i);
      templates.addAll(included.getAllValidTemplates());
    }
    templates.addAll(_templates);
    // Cache results in top-level stylesheet only
    if (_parentStylesheet != null) {
      return templates;
    }
    _allValidTemplates = templates;
   }
  
  return _allValidTemplates;
}

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

/**
  Returns <code>true</code> if the specified appender is in the
  list of attached appenders, <code>false</code> otherwise.
  @since 1.2 */
public 
boolean isAttached(Appender appender) {
 if(appenderList == null || appender == null)
  return false;
  int size = appenderList.size();
  Appender a;
  for(int i = 0; i < size; i++) {
   a  = (Appender) appenderList.elementAt(i);
   if(a == appender)
  return true;
  }
  return false;    
}

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

ComposeState()
{
 int size = m_variables.size();
 for (int i = 0; i < size; i++) 
 {
  ElemVariable ev = (ElemVariable)m_variables.elementAt(i);
  m_variableNames.addElement(ev.getName());
 }
 
}

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

String localName)
Vector listVector = new Vector();
Node retNode = dtm.getNode(node);
if (retNode != null)
int size = listVector.size();
NodeSet nodeSet = new NodeSet(size);
for (int i = 0; i < size; i++)
 nodeSet.addNode((Node)listVector.elementAt(i));

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

Vector nodes = new Vector();
 nodes.addElement(elem);
Vector scratchVector = new Vector();
 v.setItem(((NodeCompareElem) nodes.elementAt(i)).m_node, i);

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

v = new Vector(); 
 Enumeration enumeration = ht.keys();
} else {
 misses = 0;
 v.addElement(t);
int size = v.size();
for(int i = 0; i < size; i++) {
 Thread t = (Thread) v.elementAt(i);
 LogLog.debug("Lazy NDC removal for thread [" + t.getName() + "] ("+ 
    ht.size() + ").");

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

/**
 * @return key declarations for the key associated to this KeyTable
 */
private Vector getKeyDeclarations() {
 int nDeclarations = m_keyDeclarations.size();
 Vector keyDecls = new Vector(nDeclarations);
 // Walk through each of the declarations made with xsl:key
 for (int i = 0; i < nDeclarations; i++)
 {
  KeyDeclaration kd = (KeyDeclaration) m_keyDeclarations.elementAt(i);
  // Add the declaration if the name on this key declaration
  // matches the name on the iterator for this walker.
  if (kd.getName().equals(getKeyTableName())) {
   keyDecls.add(kd);
  }
 }
 return keyDecls;
}

代码示例来源:origin: apache/rocketmq

public boolean isAttached(Appender appender) {
  if (appenderList == null || appender == null) {
    return false;
  }
  int size = appenderList.size();
  Appender a;
  for (int i = 0; i < size; i++) {
    a = appenderList.elementAt(i);
    if (a == appender) {
      return true;
    }
  }
  return false;
}

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

/**
 * Add object to vector if not already there.
 *
 * @param obj
 * @param v
 */
private void addObjectIfNotFound(Object obj, Vector v)
{
 int n = v.size();
 boolean addIt = true;
 for (int i = 0; i < n; i++)
 {
  if (v.elementAt(i) == obj)
  {
   addIt = false;
   break;
  }
 }
 if (addIt)
 {
  v.addElement(obj);
 }
}

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

Vector listVector = new Vector();
Node retNode = dtm.getNode(node);
if (retNode != null) 
int size = listVector.size();
NodeSet nodeSet = new NodeSet(size);
for (int i = 0; i < size; i++) 
 nodeSet.addNode((Node) listVector.elementAt(i));

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

m_namespaceDeclSets=new Vector();
nsList=new SuballocatedIntVector(32);
m_namespaceDeclSets.addElement(nsList);
  nsList=(SuballocatedIntVector)m_namespaceDeclSets.elementAt(last);
m_namespaceDeclSets.addElement(nsList);

代码示例来源:origin: stanfordnlp/CoreNLP

public static String[] byteArrToAStringArr(byte[] b) {
 int off = 0;
 Vector<String> v = new Vector<>();
 while (off < b.length) {
  int length = byteArrToInt(b, off);
  if (length != 0) {
   v.addElement(byteArrToAString(b, off + 4, length));
  } else {
   v.addElement("");
  }
  off = off + length + 4;
 }
 String[] s = new String[v.size()];
 for (int i = 0; i < s.length; i++) {
  s[i] = v.elementAt(i);
 }
 return s;
}

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

/**
 * @return key declarations for the key associated to this KeyTable
 */
private Vector getKeyDeclarations() {
 int nDeclarations = m_keyDeclarations.size();
 Vector keyDecls = new Vector(nDeclarations);
 // Walk through each of the declarations made with xsl:key
 for (int i = 0; i < nDeclarations; i++)
 {
  KeyDeclaration kd = (KeyDeclaration) m_keyDeclarations.elementAt(i);
  // Add the declaration if the name on this key declaration
  // matches the name on the iterator for this walker.
  if (kd.getName().equals(getKeyTableName())) {
   keyDecls.add(kd);
  }
 }
 return keyDecls;
}

相关文章