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

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

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

Vector.indexOf介绍

[英]Searches in this vector for the index of the specified object. The search for the object starts at the beginning and moves towards the end of this vector.
[中]在此向量中搜索指定对象的索引。对该对象的搜索从该向量的开头开始,并向该向量的结尾移动。

代码示例

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

/**
 * Returns the index of the specified element.
 * @param element Element to be looked for.
 * @return -1 if not found.
 */
public int getIndexOf(DataElement element) {
 return _container.indexOf(element);
}

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

/**
 * Searches this vector for the specified object.
 *
 * @param object
 *            the object to look for in this vector.
 * @return {@code true} if object is an element of this vector,
 *         {@code false} otherwise.
 * @see #indexOf(Object)
 * @see #indexOf(Object, int)
 * @see java.lang.Object#equals
 */
@Override
public boolean contains(Object object) {
  return indexOf(object, 0) != -1;
}

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

/**
 * Searches in this vector for the index of the specified object. The search
 * for the object starts at the beginning and moves towards the end of this
 * vector.
 *
 * @param object
 *            the object to find in this vector.
 * @return the index in this vector of the specified element, -1 if the
 *         element isn't found.
 * @see #contains
 * @see #lastIndexOf(Object)
 * @see #lastIndexOf(Object, int)
 */
@Override
public int indexOf(Object object) {
  return indexOf(object, 0);
}

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

/**
 * Add a pattern to the default excludes unless it is already a
 * default exclude.
 *
 * @param s   A string to add as an exclude pattern.
 * @return    <code>true</code> if the string was added;
 *            <code>false</code> if it already existed.
 *
 * @since Ant 1.6
 */
public static boolean addDefaultExclude(String s) {
  if (defaultExcludes.indexOf(s) == -1) {
    defaultExcludes.add(s);
    return true;
  }
  return false;
}

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

/**
 * Get a prefix either from the uri mapping, or just make
 * one up!
 *
 * @param uri The namespace URI, which may be null.
 *
 * @return The prefix if there is one, or null.
 */
public int getIdForNamespace(String uri)
{
  int index = m_values.indexOf(uri);
  if (index < 0)
  {
   m_values.addElement(uri);
   return m_valueIndex++;
  }
  else
   return index;
}

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

/**
 * Removes the first occurrence, starting at the beginning and moving
 * towards the end, of the specified object from this vector. All elements
 * with an index bigger than the element that gets removed have their index
 * decreased by 1.
 *
 * @param object
 *            the object to remove from this vector.
 * @return {@code true} if the specified object was found, {@code false}
 *         otherwise.
 * @see #removeAllElements
 * @see #removeElementAt
 * @see #size
 */
public synchronized boolean removeElement(Object object) {
  int index;
  if ((index = indexOf(object, 0)) == -1) {
    return false;
  }
  removeElementAt(index);
  return true;
}

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

/**
 * Get a prefix either from the uri mapping, or just make
 * one up!
 *
 * @param uri The namespace URI, which may be null.
 *
 * @return The prefix if there is one, or null.
 */
public int getIdForNamespace(String uri)
{
  int index = m_values.indexOf(uri);
  if (index < 0)
  {
   m_values.addElement(uri);
   return m_valueIndex++;
  }
  else
   return index;
}

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

/**
 * Get a prefix either from the qname or from the uri mapping, or just make
 * one up!
 *
 * @return The prefix if there is one, or null.
 */
public String getNamespaceURI(String prefix)
{
 String uri = "";
 int prefixIndex = m_contextIndexes.peek() - 1 ;
 if(null == prefix)
  prefix = "";
  do
  {
   prefixIndex = m_prefixMappings.indexOf(prefix, ++prefixIndex);
  } while ( (prefixIndex >= 0) && (prefixIndex & 0x01) == 0x01);
  if (prefixIndex > -1)
  {
   uri = (String) m_prefixMappings.elementAt(prefixIndex + 1);
  }
 return uri;
}

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

/**
 * Get a prefix either from the qname or from the uri mapping, or just make
 * one up!
 *
 * @return The prefix if there is one, or null.
 */
public String getNamespaceURI(String prefix)
{
 String uri = "";
 int prefixIndex = m_contextIndexes.peek() - 1 ;
 if(null == prefix)
  prefix = "";
  do
  {
   prefixIndex = m_prefixMappings.indexOf(prefix, ++prefixIndex);
  } while ( (prefixIndex >= 0) && (prefixIndex & 0x01) == 0x01);
  if (prefixIndex > -1)
  {
   uri = (String) m_prefixMappings.elementAt(prefixIndex + 1);
  }
 return uri;
}

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

public void setView(List columns) {
 TableColumnModel model = getColumnModel();
 // Remove all the columns:
 for (int f = 0; f < _numCols; f++) {
  model.removeColumn(_tableColumns[f]);
 }
 Iterator selectedColumns = columns.iterator();
 Vector columnNameAndNumber = getColumnNameAndNumber();
 while (selectedColumns.hasNext()) {
  // add the column to the view
  model.addColumn(_tableColumns[columnNameAndNumber.indexOf(selectedColumns.next())]);
 }
 //SWING BUG:
 sizeColumnsToFit(-1);
}

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

/**
 * Receive notification of the end of a Namespace mapping.
 *
 * <p>By default, do nothing.  Application writers may override this
 * method in a subclass to take specific actions at the end of
 * each prefix mapping.</p>
 *
 * @param prefix The Namespace prefix being declared.
 * @throws SAXException Any SAX exception, possibly
 *            wrapping another exception.
 * @see org.xml.sax.ContentHandler#endPrefixMapping
 */
public void endPrefixMapping(String prefix) throws SAXException
{
 if (DEBUG)
  System.out.println("endPrefixMapping: prefix: " + prefix);
 if(null == prefix)
  prefix = "";
 int index = m_contextIndexes.peek() - 1;
 do
 {
  index = m_prefixMappings.indexOf(prefix, ++index);
 } while ( (index >= 0) && ((index & 0x01) == 0x01) );
 if (index > -1)
 {
  m_prefixMappings.setElementAt("%@$#^@#", index);
  m_prefixMappings.setElementAt("%@$#^@#", index + 1);
 }
 // no op
}

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

@ExpectWarning("GC")
public void test() {
  LinkedList<Integer> lst = new LinkedList<Integer>();
  lst.add(1);
  lst.add(2);
  lst.add(3);
  lst.removeFirstOccurrence("a");
  lst.removeLastOccurrence("a");
  Vector<Integer> v = new Vector<Integer>();
  v.addAll(lst);
  v.indexOf((long) 1, 1);
  v.lastIndexOf((long) 1, 1);
}

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

/**
 * Receive notification of the end of a Namespace mapping.
 *
 * <p>By default, do nothing.  Application writers may override this
 * method in a subclass to take specific actions at the end of
 * each prefix mapping.</p>
 *
 * @param prefix The Namespace prefix being declared.
 * @throws SAXException Any SAX exception, possibly
 *            wrapping another exception.
 * @see org.xml.sax.ContentHandler#endPrefixMapping
 */
public void endPrefixMapping(String prefix) throws SAXException
{
 if (DEBUG)
  System.out.println("endPrefixMapping: prefix: " + prefix);
 if(null == prefix)
  prefix = "";
 int index = m_contextIndexes.peek() - 1;
 do
 {
  index = m_prefixMappings.indexOf(prefix, ++index);
 } while ( (index >= 0) && ((index & 0x01) == 0x01) );
 if (index > -1)
 {
  m_prefixMappings.setElementAt("%@$#^@#", index);
  m_prefixMappings.setElementAt("%@$#^@#", index + 1);
 }
 // no op
}

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

uriIndex = m_prefixMappings.indexOf(uri, ++uriIndex);
} while ( (uriIndex & 0x01) == 0);

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

uriIndex = m_prefixMappings.indexOf(uri, ++uriIndex);
} while ( (uriIndex & 0x01) == 0);

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

Element phone = e;
String p = phone.getAttribute("p");
index = ph.indexOf(p);
int currentDur = dur.elementAt(index);
totalDur += currentDur * 0.001f;
  index = ph.indexOf("_");
  int currentDur = dur.elementAt(index);
  totalDur += currentDur * 0.001f;

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

Element phone = e;
String p = phone.getAttribute("p");
index = ph.indexOf(p);
int currentDur = dur.elementAt(index);
totalDur += currentDur * 0.001f;
  index = ph.indexOf("_");
  int currentDur = dur.elementAt(index);
  totalDur += currentDur * 0.001f;

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

index = ph.indexOf(p);
int currentDur = dur.elementAt(index);
String currentF0 = f0.elementAt(index);
  index = ph.indexOf("_");
  int currentDur = dur.elementAt(index);
  totalDur += currentDur * 0.001f;

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

index = ph.indexOf(p);
int currentDur = dur.elementAt(index);
String currentF0 = f0.elementAt(index);
  index = ph.indexOf("_");
  int currentDur = dur.elementAt(index);
  totalDur += currentDur * 0.001f;

代码示例来源:origin: Sable/soot

int pos = nodes.indexOf(s);
copy(valueAfter.elementAt(pos), previousAfterFlow);
  copy(valueAfter.elementAt(nodes.indexOf(preds.get(0))), beforeFlow);
  copy(valueAfter.elementAt(nodes.indexOf(obj)), beforeFlow);
   if (nodes.indexOf(stmt) >= 0) // RLH
    Object otherBranchFlow = valueAfter.elementAt(nodes.indexOf(stmt));
 afterFlow = valueAfter.elementAt(nodes.indexOf(s));
 flowThrough(beforeFlow, s, afterFlow);
 valueAfter.set(nodes.indexOf(s), afterFlow);

相关文章

微信公众号

最新文章

更多