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

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

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

Vector.removeElementAt介绍

[英]Removes the element found at index position location from this Vector. All elements with an index bigger than location have their index decreased by 1.
[中]从此向量中删除在索引位置找到的元素。索引大于位置的所有元素的索引都会减少1。

代码示例

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

/**
 * remove a runtime configurable wrapper from the stack
 */
public void popWrapper() {
  if (wStack.size() > 0) {
    wStack.removeElementAt(wStack.size() - 1);
  }
}

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

public void removeAppender(String name) {
  if (name == null || appenderList == null) {
    return;
  }
  int size = appenderList.size();
  for (int i = 0; i < size; i++) {
    if (name.equals((appenderList.elementAt(i)).getName())) {
      appenderList.removeElementAt(i);
      break;
    }
  }
}

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

/**
 * Removes a {@link DataElement} at the specified index. 
 * After the element has been successfully removed
 * all {@link DataListener DataListeners} will be informed.
 * @param index Index of the element which will be removed.
 *        All elements with an index &gt; <tt>index</tt> will be shifted.
 */
public void removeElementAt(int index) {
 DataElement element = (DataElement) _container.elementAt(index);
 element.setContainer(null);
 _container.removeElementAt(index);
 notifyListeners(DataEvent.createRemoveEvent(this, index, element));
}

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

/**
 Remove the appender with the name passed as parameter form the
 list of appenders.  
*/
public
void removeAppender(String name) {
 if(name == null || appenderList == null) return;
 int size = appenderList.size();
 for(int i = 0; i < size; i++) {
  if(name.equals(((Appender)appenderList.elementAt(i)).getName())) {
  appenderList.removeElementAt(i);
  break;
  }
 }
}

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

PSQLState.INVALID_CURSOR_STATE);
if (rows.size() == 0)
int numKeys = primaryKeys.size();
if ( deleteStatement == null )
rows.removeElementAt(current_row);
current_row--;
moveToCurrentRow();

代码示例来源:origin: org.netbeans.api/org-openide-awt

@Override
protected void trimEdits(int from, int to) {
  if (from <= to) {
    for (int i = to; from <= i; i--) {
      UndoableEdit e = edits.elementAt(i);
      e.die();
      edits.removeElementAt(i);
    }
    if (indexOfNextAdd > to) {
      indexOfNextAdd -= to-from+1;
    } else if (indexOfNextAdd >= from) {
      indexOfNextAdd = from;
    }
  }
}

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

/** JJK: Support  <?xalan:doc_cache_off?> kluge in ElemForEach.
 * TODO: This function is highly dangerous. Cache management must be improved.
 *
 * @param n The node to remove.
 */
public void removeDocumentFromCache(int n)
{
 if(DTM.NULL ==n)
  return;
 for(int i=m_sourceTree.size()-1;i>=0;--i)
 {
  SourceTree st=(SourceTree)m_sourceTree.elementAt(i);
  if(st!=null && st.m_root==n)
  {
 m_sourceTree.removeElementAt(i);
 return;
  }
 }
}

代码示例来源:origin: org.netbeans.api/org-openide-awt

@Override
public boolean addEdit(UndoableEdit anEdit) {
  boolean retVal;
  // Trim from the indexOfNextAdd to the end, as we'll
  // never reach these edits once the new one is added.
  trimEdits(indexOfNextAdd, edits.size()-1);
  if (!inProgress) {
    retVal = false;
  } else {
    UndoableEdit last = lastEdit();
    if (last == null) {
      edits.addElement(anEdit);
    } else if (!last.addEdit(anEdit)) {
      if (anEdit.replaceEdit(last)) {
        edits.removeElementAt(edits.size() - 1);
      }
      edits.addElement(anEdit);
    }
    retVal = true;
  }
  // Maybe super added this edit, maybe it didn't (perhaps
  // an in progress compound edit took it instead. Or perhaps
  // this UndoManager is no longer in progress). So make sure
  // the indexOfNextAdd is pointed at the right place.
  indexOfNextAdd = edits.size();
  // Enforce the limit
  trimForLimit();
  return retVal;
}

代码示例来源:origin: camunda/camunda-bpm-platform

/**
 * Remove the part at specified location (starting from 0).
 * Shifts all the parts after the removed part down one.
 *
 * @param   index    Index of the part to remove
 * @exception       IndexOutOfBoundsException if the given index
 *            is out of range.
 * @exception    IllegalWriteException if the underlying
 *            implementation does not support modification
 *            of existing values
 * @exception    MessagingException for other failures
 */
public synchronized void removeBodyPart(int index)
      throws MessagingException {
if (parts == null)
  throw new IndexOutOfBoundsException("No such BodyPart");
BodyPart part = (BodyPart)parts.elementAt(index);
parts.removeElementAt(index);
part.setParent(null);
}

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

/** JJK: Support  <?xalan:doc_cache_off?> kluge in ElemForEach.
 * TODO: This function is highly dangerous. Cache management must be improved.
 *
 * @param n The node to remove.
 */
public void removeDocumentFromCache(int n)
{
 if(DTM.NULL ==n)
  return;
 for(int i=m_sourceTree.size()-1;i>=0;--i)
 {
  SourceTree st=(SourceTree)m_sourceTree.elementAt(i);
  if(st!=null && st.m_root==n)
  {
 m_sourceTree.removeElementAt(i);
 return;
  }
 }
}

代码示例来源:origin: dermotte/LIRE

for (int i = 0; i < matches.size(); ) {
  boolean amb = false;
  PointMatch m = matches.get(i);
  float[] m_p2 = m.getP2().getL();
  for (int j = i + 1; j < matches.size(); ) {
    PointMatch n = matches.get(j);
    float[] n_p2 = n.getP2().getL();
      amb = true;
      matches.removeElementAt(j);
    } else ++j;
    matches.removeElementAt(i);
  } else ++i;

代码示例来源:origin: com.sun.mail/javax.mail

/**
 * Remove the part at specified location (starting from 0).
 * Shifts all the parts after the removed part down one.
 *
 * @param   index    Index of the part to remove
 * @exception       IndexOutOfBoundsException if the given index
 *            is out of range.
 * @exception    IllegalWriteException if the underlying
 *            implementation does not support modification
 *            of existing values
 * @exception    MessagingException for other failures
 */
public synchronized void removeBodyPart(int index)
      throws MessagingException {
if (parts == null)
  throw new IndexOutOfBoundsException("No such BodyPart");
BodyPart part = parts.elementAt(index);
parts.removeElementAt(index);
part.setParent(null);
}

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

/**
 * @param con
 *
 * @throws SQLException
 */
public synchronized void releaseConnectionOnError( Connection con )throws SQLException
{
 // find the PooledConnection Object
 for ( int x = 0; x < m_pool.size(); x++ )
 {
  PooledConnection pcon =
   (PooledConnection) m_pool.elementAt(x);
  // Check for correct Connection
  if ( pcon.getConnection() == con )
  {
   if (DEBUG)
   {
    System.out.println("Releasing Connection On Error" + x);
   }
   con.close();
   m_pool.removeElementAt(x);
   if (DEBUG)
   {
    System.out.println("-->Inactive Pool, Closing connection");
   }
   break;
  }
 }
}

代码示例来源:origin: dermotte/LIRE

for (int i = 0; i < matches.size(); ) {
  boolean amb = false;
  PointMatch m = matches.get(i);
  float[] m_p2 = m.getP2().getL();
  for (int j = i + 1; j < matches.size(); ) {
    PointMatch n = matches.get(j);
    float[] n_p2 = n.getP2().getL();
      amb = true;
      matches.removeElementAt(j);
    } else ++j;
    matches.removeElementAt(i);
  } else ++i;

代码示例来源:origin: eclipse/paho.mqtt.java

if (!completeQueue.isEmpty()) {
  token = (MqttToken) completeQueue.elementAt(0);
  completeQueue.removeElementAt(0);
  message = (MqttPublish) messageQueue.elementAt(0);
  messageQueue.removeElementAt(0);

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

/**
  Release the underlying ServerMonitor thread, and drop the connections
  to all connected remote servers. */
public 
void cleanUp() {
 // stop the monitor thread
 LogLog.debug("stopping ServerSocket");
 serverMonitor.stopMonitor();
 serverMonitor = null;
 // close all of the connections
 LogLog.debug("closing client connections");
 while (oosList.size() != 0) {
  ObjectOutputStream oos = (ObjectOutputStream)oosList.elementAt(0);
  if(oos != null) {
   try {
     oos.close();
   } catch(InterruptedIOException e) {
     Thread.currentThread().interrupt();
     LogLog.error("could not close oos.", e);
   } catch(IOException e) {
     LogLog.error("could not close oos.", e);
   }
   
   oosList.removeElementAt(0);     
  }
 }
}

代码示例来源:origin: eclipse/paho.mqtt.java

(pendingFlows.isEmpty() || !((MqttWireMessage)pendingFlows.elementAt(0) instanceof MqttConnect))) {
result = (MqttWireMessage)pendingMessages.elementAt(0);
pendingMessages.removeElementAt(0);
actualInFlight++;

代码示例来源:origin: javax.activation/activation

int size = stack.size();
if (size > 0) {
  String t = (String)stack.elementAt(size - 1);
  stack.removeElementAt(size - 1);
  return t;

代码示例来源:origin: sakaiproject/sakai

/**
 * Get the next asset from the queue, increment the index
 * @return The next available asset (the asset is removed from the queue)
 */
private synchronized org.osid.repository.Asset getAsset()
{
   org.osid.repository.Asset asset = (org.osid.repository.Asset) assetVector.elementAt(0);
   assetVector.removeElementAt(0);
  index++;
   return asset;
 }

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

Vector<String> rendList = PlugInManager.getPlugInList(null, null,
    plType);
int listSize = rendList.size();
boolean found = false;
String rname;
  rname = rendList.elementAt(i);
  if (rname.equals(dar)) { // DAR is in the registry
    found = true;
    rendList.removeElementAt(i);
    break;

相关文章

微信公众号

最新文章

更多