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

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

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

Stack.iterator介绍

暂无

代码示例

代码示例来源:origin: jphp-group/jphp

@Override
  public void reset() {
    synchronized (mutex) {
      index = -1;
      currentKeyMemory = Memory.CONST_INT_M1;
      currentKey = currentKeyMemory;
      iterator = stack.iterator();
    }
  }
};

代码示例来源:origin: galenframework/galen

private List<String> getAllCurrentGroups() {
    List<String> allCurrentGroups = new LinkedList<>();

    Iterator<List<String>> it = groupStack.iterator();
    while(it.hasNext()) {
      for (String groupName : it.next()) {
        if (!allCurrentGroups.contains(groupName)) {
          allCurrentGroups.add(groupName);
        }
      }
    }
    return allCurrentGroups;
  }
}

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

/**
 * Returns a {@code List} of all the opened/active activities.
 * 
 * @return a {@code List} of all the opened/active activities
 */
public ArrayList<Activity> getAllOpenedActivities()
{
  ArrayList<Activity> activities = new ArrayList<Activity>();
  Iterator<WeakReference<Activity>> activityStackIterator = activityStack.iterator();
  while(activityStackIterator.hasNext()){
    Activity  activity = activityStackIterator.next().get();
    if(activity!=null)
      activities.add(activity);
  }
  return activities;
}

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

/**
 * Removes a given activity from the activity stack
 * 
 * @param activity the activity to remove
 */
private void removeActivityFromStack(Activity activity){
  Iterator<WeakReference<Activity>> activityStackIterator = activityStack.iterator();
  while(activityStackIterator.hasNext()){
    Activity activityFromWeakReference = activityStackIterator.next().get();
    if(activityFromWeakReference == null){
      activityStackIterator.remove();
    }
    if(activity != null && activityFromWeakReference != null && activityFromWeakReference.equals(activity)){
      activityStackIterator.remove();
    }
  }
}

代码示例来源:origin: commons-pool/commons-pool

/**
 * Clears any objects sitting idle in the pool. Silently swallows any
 * exceptions thrown by {@link PoolableObjectFactory#destroyObject(Object)}.
 */
@Override
public synchronized void clear() {
  if(null != _factory) {
    Iterator<T> it = _pool.iterator();
    while(it.hasNext()) {
      try {
        _factory.destroyObject(it.next());
      } catch(Exception e) {
        // ignore error, keep destroying the rest
      }
    }
  }
  _pool.clear();
}

代码示例来源:origin: commons-pool/commons-pool

/**
 * Destroys all instances in the stack and clears the stack.
 * 
 * @param key key passed to factory when destroying instances
 * @param stack stack to destroy
 */
private synchronized void destroyStack(K key, Stack<V> stack) {
  if(null == stack) {
    return;
  } else {
    if(null != _factory) {
      Iterator<V> it = stack.iterator();
      while(it.hasNext()) {
        try {
          _factory.destroyObject(key,it.next());
        } catch(Exception e) {
          // ignore error, keep destroying the rest
        }
      }
    }
    _totIdle -= stack.size();
    _activeCount.remove(key);
    stack.clear();
  }
}

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

public void dispose(boolean force) {
  ///////////////////////////////////////////////////////////////////////
  //
  // Dispose local intermediate operations
  //
  ///////////////////////////////////////////////////////////////////////
  final Iterator<RenderedImage> it = intermediateOps.iterator();
  while (it.hasNext()) {
    final PlanarImage image = PlanarImage.wrapRenderedImage((RenderedImage) it.next());
    image.dispose();
  }
  super.dispose(force);
}

代码示例来源:origin: graphstream/gs-core

@SuppressWarnings("unchecked")
public <T extends Edge> Iterator<T> getEdgeIterator() {
  return (Iterator<T>) edgePath.iterator();
}

代码示例来源:origin: org.apache.tapestry/tapestry-framework

/**
 * {@inheritDoc}
 */
public Iterator renderStackIterator()
{
  return _renderStack.iterator();
}

代码示例来源:origin: org.jboss.openjdk-orb/openjdk-orb

Object get(Object key) {
  if (pairs == null) {
    return null;
  }
  for (Iterator i = pairs.iterator(); i.hasNext();) {
    KeyValuePair pair = (KeyValuePair)i.next();
    if (pair.key == key) {
      return pair.value;
    }
  }
  return null;
}

代码示例来源:origin: org.jboss.openjdk-orb/openjdk-orb-jdk9-supplement

Object get(Object key) {
  if (pairs == null) {
    return null;
  }
  for (Iterator i = pairs.iterator(); i.hasNext();) {
    KeyValuePair pair = (KeyValuePair)i.next();
    if (pair.key == key) {
      return pair.value;
    }
  }
  return null;
}

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/org-netbeans-modules-editor-lib

public boolean containsValue(Object value) {
  for (Iterator it = stack.iterator(); it.hasNext();) {
    if (((Map)it.next()).containsValue(value))
      return true;
  }
  return false;
}

代码示例来源:origin: org.onehippo.cms7/hippo-repository-engine

private static String toBundleName(final Stack<String> path) {
  final StringBuilder sb = new StringBuilder();
  final Iterator<String> iterator = path.iterator();
  while (iterator.hasNext()) {
    sb.append(iterator.next());
    if (iterator.hasNext()) {
      sb.append(".");
    }
  }
  return sb.toString();
}

代码示例来源:origin: org.kuali.student.core/ks-common-impl

protected String getElementXpath(Stack<String> elementStack) {
  StringBuilder xPath = new StringBuilder();
  Iterator<String> itr = elementStack.iterator();
  while (itr.hasNext()) {
    xPath.append(itr.next());
    if (itr.hasNext()) {
      xPath.append("/");
    }
  }
  return xPath.toString();
}

代码示例来源:origin: org.gosu-lang.goson/goson

private static String makePath(Stack<String> propertyPath) {
 StringBuilder sb = new StringBuilder();
 for (Iterator<String> iterator = propertyPath.iterator(); iterator.hasNext(); ) {
  String s = iterator.next();
  sb.append(s);
  if (iterator.hasNext()) {
   sb.append(".");
  }
 }
 return sb.toString();
}

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

protected String getContext() {
  StringBuffer buf = new StringBuffer();
  for (Iterator iter = contextStack.iterator(); iter.hasNext();) {
    String ctx = (String) iter.next();
    buf.append(ctx).append("/");
  }
  if (buf.length() > 0) {
    buf.setLength(buf.length() - 1);
  }
  return buf.toString();
}

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

private String getContext() {
  StringBuffer buf = new StringBuffer();
  for (Iterator iter = context.iterator(); iter.hasNext();) {
    String ctx = (String) iter.next();
    buf.append(ctx).append("/");
  }
  if (buf.length() > 0) {
    buf.setLength(buf.length() - 1);
  }
  return buf.toString();
}

代码示例来源:origin: org.walkmod/javalang-compiler

public Map<String, SymbolType> flat() {
  Map<String, SymbolType> result = new LinkedHashMap<String, SymbolType>();
  Iterator<Scope> it = indexStructure.iterator();
  while (it.hasNext()) {
    Scope scope = it.next();
    List<Symbol<?>> symbols = scope.getSymbols();
    for (Symbol<?> s : symbols) {
      result.put(s.getName(), s.getType());
    }
  }
  return result;
}

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

public void clearProblems() {
  getDefaultLogger().clearProblems();
  for (Iterator iter = getLoggerStack().iterator(); iter.hasNext();) {
    MessageLogger l = (MessageLogger) iter.next();
    l.clearProblems();
  }
  problems.clear();
  errors.clear();
  warns.clear();
}

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

public void setShowProgress(boolean progress) {
  getDefaultLogger().setShowProgress(progress);
  // updates all loggers in the stack
  for (Iterator iter = getLoggerStack().iterator(); iter.hasNext();) {
    MessageLogger l = (MessageLogger) iter.next();
    l.setShowProgress(progress);
  }
}

相关文章