java.util.Stack.remove()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(7.1k)|赞(0)|评价(0)|浏览(225)

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

Stack.remove介绍

暂无

代码示例

代码示例来源:origin: north2016/T-MVP

@Override
  public void onActivityDestroyed(Activity activity) {
    store.remove(activity);
  }
}

代码示例来源:origin: jaydenxiao2016/AndroidFire

/**
 * 移除指定的Activity
 */
public void removeActivity(Activity activity) {
  if (activity != null) {
    activityStack.remove(activity);
    activity = null;
  }
}

代码示例来源:origin: bingoogolapple/BGASwipeBackLayout-Android

@Override
public void onActivityDestroyed(Activity activity) {
  mActivityStack.remove(activity);
}

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

public boolean removeLensFlare(LensFlare lensFlare) {
  return mLensFlares.remove(lensFlare);
}

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

private synchronized void prioritizeTableForPrewarm(String tblName) {
  // If the table is in the pending prewarm list, move it to the top
  if (tableNames.remove(tblName)) {
   tableNames.push(tblName);
  }
 }
}

代码示例来源:origin: seven332/EhViewer

@Override
protected void onCancelRequest(int index) {
 synchronized (requests) {
  requests.remove(Integer.valueOf(index));
 }
}

代码示例来源:origin: seven332/EhViewer

@Override
public void onCancelRequest(int index) {
  synchronized (mRequests) {
    mRequests.remove(Integer.valueOf(index));
  }
}

代码示例来源:origin: jaydenxiao2016/AndroidFire

/**
 * 结束指定的Activity
 */
public void finishActivity(Activity activity) {
  if (activity != null) {
    activityStack.remove(activity);
    activity.finish();
    activity = null;
  }
}

代码示例来源:origin: chentao0707/SimplifyReader

/**
 * Makes sure that the size of mScrapViews does not exceed the size of mActiveViews.
 * (This can happen if an adapter does not recycle its views).
 */
private void pruneScrapViews() {
  final int maxViews = mActiveViews.length;
  final int viewTypeCount = mViewTypeCount;
  final Stack<View>[] scrapViews = mScrapViews;
  for (int i = 0; i < viewTypeCount; ++i) {
    final Stack<View> scrapPile = scrapViews[i];
    int size = scrapPile.size();
    final int extras = size - maxViews;
    size--;
    for (int j = 0; j < extras; j++) {
      removeDetachedView(scrapPile.remove(size--), false);
    }
  }
}

代码示例来源:origin: JingYeoh/FragmentRigger

private void removeFromStack(@NonNull Activity activity) {
  mActivityStack.remove(activity);
}

代码示例来源:origin: chentao0707/SimplifyReader

/**
 * Clears the scrap heap.
 */
void clear() {
  if (mViewTypeCount == 1) {
    final Stack<View> scrap = mCurrentScrap;
    final int scrapCount = scrap.size();
    for (int i = 0; i < scrapCount; i++) {
      removeDetachedView(scrap.remove(scrapCount - 1 - i), false);
    }
  } else {
    final int typeCount = mViewTypeCount;
    for (int i = 0; i < typeCount; i++) {
      final Stack<View> scrap = mScrapViews[i];
      final int scrapCount = scrap.size();
      for (int j = 0; j < scrapCount; j++) {
        removeDetachedView(scrap.remove(scrapCount - 1 - j), false);
      }
    }
  }
}

代码示例来源:origin: jenkinsci/jenkins

/**
 * Returns true if a project has a non-direct dependency to another project.
 * <p>
 * A non-direct dependency is a path of dependency "edge"s from the source to the destination,
 * where the length is greater than 1.
 */
public boolean hasIndirectDependencies(AbstractProject src, AbstractProject dst) {
  Set<AbstractProject> visited = new HashSet<AbstractProject>();
  Stack<AbstractProject> queue = new Stack<AbstractProject>();
  queue.addAll(getDownstream(src));
  queue.remove(dst);
  while(!queue.isEmpty()) {
    AbstractProject p = queue.pop();
    if(p==dst)
      return true;
    if(visited.add(p))
      queue.addAll(getDownstream(p));
  }
  return false;
}

代码示例来源:origin: JingYeoh/FragmentRigger

/**
 * Removes the specified object onto the top of the stack.
 *
 * @param fragmentTag the fragment that will be removed.
 */
public boolean remove(String fragmentTag) {
  if (TextUtils.isEmpty(fragmentTag)) return false;
  if (!contain(fragmentTag)) return false;
  mFragmentStack.remove(fragmentTag);
  mFragmentContainerMap.remove(fragmentTag);
  return true;
}

代码示例来源:origin: JingYeoh/FragmentRigger

/**
 * Remove the specified objects onto the stack which is placed into the container view.
 *
 * @param containerViewId the container view that fragment is placed in.
 */
public boolean remove(@IdRes int containerViewId) {
  Iterator<Entry<String, Integer>> iterator = mFragmentContainerMap.entrySet().iterator();
  while (iterator.hasNext()) {
    Entry<String, Integer> entry = iterator.next();
    if (entry.getValue() == containerViewId) {
      mFragmentStack.remove(entry.getKey());
      iterator.remove();
    }
  }
  return true;
}

代码示例来源:origin: RobotiumTech/robotium

void monitorActivities() {
  if(activityMonitor != null){
    Activity activity = activityMonitor.waitForActivityWithTimeout(2000L);
    if(activity != null){
      if (activitiesStoredInActivityStack.remove(activity.toString())){
        removeActivityFromStack(activity);
      }
      if(!activity.isFinishing()){
        addActivityToStack(activity);
      }
    }
  }
}

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

/**
  * Enumerate numLevels of ancestors by putting them in the stack and dispatch
  * the current node.
  * @param nd current operator in the ancestor tree
  * @param level how many level of ancestors included in the stack
  * @param stack operator stack
  * @throws SemanticException
  */
 @SuppressWarnings("unchecked")
 private void walk(Node nd, int level, Stack<Node> stack) throws SemanticException {
  List<Operator<? extends OperatorDesc>> parents =
    ((Operator<? extends OperatorDesc>)nd).getParentOperators();

  if (level >= numLevels || parents == null || parents.isEmpty()) {
   dispatch(stack.peek(), stack);
   return;
  }

  for(Node parent : parents) {
   stack.add(0, parent);
   walk(parent, level+1, stack);
   stack.remove(0);
  }
 }
}

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

/**
  * Enumerate numLevels of ancestors by putting them in the stack and dispatch
  * the current node.
  * @param nd current operator in the ancestor tree
  * @param level how many level of ancestors included in the stack
  * @param stack operator stack
  * @throws SemanticException
  */
 @SuppressWarnings("unchecked")
 private void walk(Node nd, int level, Stack<Node> stack) throws SemanticException {
  List<Operator<? extends OperatorDesc>> parents =
    ((Operator<? extends OperatorDesc>)nd).getParentOperators();

  if (level >= numLevels || parents == null || parents.isEmpty()) {
   dispatch(stack.peek(), stack);
   return;
  }

  for(Node parent : parents) {
   stack.add(0, parent);
   walk(parent, level+1, stack);
   stack.remove(0);
  }
 }
}

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

/**
  * This is only called for fatal errors, where the physical connection is useless afterward and
  * should be removed from the pool.
  */
 public void connectionErrorOccurred(ConnectionEvent event) {
  ((PooledConnection) event.getSource()).removeConnectionEventListener(this);
  synchronized (lock) {
   if (available == null) {
    return; // DataSource has been closed
   }
   used.remove(event.getSource());
   // We're now at least 1 connection under the max
   lock.notify();
  }
 }
};

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

public void connectionClosed(ConnectionEvent event) {
 ((PooledConnection) event.getSource()).removeConnectionEventListener(this);
 synchronized (lock) {
  if (available == null) {
   return; // DataSource has been closed
  }
  boolean removed = used.remove(event.getSource());
  if (removed) {
   available.push((PooledConnection) event.getSource());
   // There's now a new connection available
   lock.notify();
  } else {
   // a connection error occurred
  }
 }
}

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

/**
   * This is only called for fatal errors, where the physical connection is
   * useless afterward and should be removed from the pool.
   */
  public void connectionErrorOccurred(ConnectionEvent event)
  {
    ((PooledConnection) event.getSource()).removeConnectionEventListener(this);
    synchronized (lock )
    {
      if (available == null)
      {
        return ; // DataSource has been closed
      }
      used.remove(event.getSource());
      // We're now at least 1 connection under the max
      lock.notify();
    }
  }
};

相关文章