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

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

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

Stack.listIterator介绍

暂无

代码示例

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

String styleString = ""; // $NON-NLS-1$
ListIterator layerIter = layers.listIterator(layers.size());
ListIterator styleIter = styles.listIterator(styles.size());
while (layerIter.hasPrevious()) {

代码示例来源:origin: org.astrogrid/astrogrid-adqlparser-base

public ListIterator listIterator() {
  return stack.listIterator();
}

代码示例来源:origin: org.astrogrid/astrogrid-adqlstox

public ListIterator listIterator() {
  return stack.listIterator();
}

代码示例来源:origin: javanettasks/httpunit

private Iterator getTopDownIterator( final Stack stack ) {
  return new Iterator() {
    private ListIterator _forwardIterator = stack.listIterator( stack.size() );
    public boolean hasNext() {
      return _forwardIterator.hasPrevious();
    }
    public Object next() {
      return _forwardIterator.previous();
    }
    public void remove() {
      _forwardIterator.remove();
    }
  };
}

代码示例来源:origin: ogarcia/opensudoku

public AbstractSingleCellCommand findLatestSingleCellCommand() {
  ListIterator<AbstractCommand> iter = mCommandStack.listIterator(mCommandStack.size());
  while (iter.hasPrevious()) {
    AbstractCommand o = iter.previous();
    if (o instanceof AbstractSingleCellCommand)
      return (AbstractSingleCellCommand) o;
  }
  return null;
}

代码示例来源:origin: openmrs/openmrs-module-htmlformentry

/**
 * Utility method that returns the object of a specified class that was most recently added to
 * the stack
 */
@SuppressWarnings("unchecked")
private <T> T highestOnStack(Class<T> clazz) {
  for (ListIterator<Object> iter = stack.listIterator(stack.size()); iter.hasPrevious();) {
    Object o = iter.previous();
    if (clazz.isAssignableFrom(o.getClass()))
      return (T) o;
  }
  return null;
}

代码示例来源:origin: org.ow2.bonita/bonita-client

/** search a contextual object in the stack by type. */
@SuppressWarnings("unchecked")
public <T> T findObject(final Class<T> clazz) {
 if (objectStack != null && !objectStack.isEmpty()) {
  final ListIterator<Object> listIter = objectStack.listIterator(objectStack.size());
  while (listIter.hasPrevious()) {
   final Object object = listIter.previous();
   if (object != null && clazz.isAssignableFrom(object.getClass())) {
    return (T) object;
   }
  }
  return null;
 }
 return null;
}

代码示例来源:origin: net.sf.okapi.filters/okapi-filter-abstractmarkup

public boolean isInlineExcludedState() {
  if (inlineRuleStack.isEmpty()) {
    return false;
  }
  // reverse the stack as we want to see the most recently added first
  //ReversedIterator<RuleType> ri = new ReversedIterator<RuleType>(inlineRuleStack);
  // JEH 9/16/13 ReversedIterator was very slow - try a listIterator and move backwards 
  ListIterator<RuleType> ri = inlineRuleStack.listIterator(inlineRuleStack.size());
  while (ri.hasPrevious()) {
    RuleType rt = ri.previous();
    if (rt.ruleType == RULE_TYPE.INLINE_EXCLUDED_ELEMENT) {
      return true;
    }
  }
  return false;
}

代码示例来源:origin: org.ow2.bonita/bonita-server

/** search a contextual object in the stack by type. */
@SuppressWarnings("unchecked")
public <T> T findObject(final Class<T> clazz) {
 if (objectStack != null && !objectStack.isEmpty()) {
  final ListIterator<Object> listIter = objectStack.listIterator(objectStack.size());
  while (listIter.hasPrevious()) {
   final Object object = listIter.previous();
   if (object != null && clazz.isAssignableFrom(object.getClass())) {
    return (T) object;
   }
  }
  return null;
 }
 return null;
}

代码示例来源:origin: org.jbpm/pvm

/** search a contextual object in the stack by type. */
public <T> T findObject(Class<T> clazz) {
 if ( (objectStack!=null)
    && (! objectStack.isEmpty())
   ) {
  ListIterator<Object> listIter = objectStack.listIterator(objectStack.size());
  while (listIter.hasPrevious()) {
   Object object = listIter.previous();
   if (object!=null) {
    if (clazz.isAssignableFrom(object.getClass())) {
     return (T) object;
    }
   }
  }
  return null;
 }
 return null;
}

代码示例来源:origin: net.sf.okapi.filters/okapi-filter-abstractmarkup

public boolean isExludedState() {
  if (excludedIncludedRuleStack.isEmpty()) {
    return excludeByDefault;
  }
  
  // reverse the stack as we want to see the most recently added first
  //ReversedIterator<RuleType> ri = new ReversedIterator<RuleType>(excludedIncludedRuleStack);
  // JEH 9/16/13 ReversedIterator was very slow - try a listIterator and move backwards 
  ListIterator<RuleType> ri = excludedIncludedRuleStack.listIterator(excludedIncludedRuleStack.size());
  while (ri.hasPrevious()) {
    RuleType rt = ri.previous();        
    if (rt.ruleType == RULE_TYPE.EXCLUDED_ELEMENT) {
      return true;
    }
    
    if (rt.ruleType == RULE_TYPE.INCLUDED_ELEMENT) {
      return false;
    }
  }
  
  return excludeByDefault;
}

代码示例来源:origin: org.ow2.bonita/bonita-pvm

/** search a contextual object in the stack by type. */
public <T> T findObject(Class<T> clazz) {
 if ((objectStack != null) && (!objectStack.isEmpty())) {
  ListIterator<Object> listIter = objectStack.listIterator(objectStack
    .size());
  while (listIter.hasPrevious()) {
   Object object = listIter.previous();
   if (object != null) {
    if (clazz.isAssignableFrom(object.getClass())) {
     return (T) object;
    }
   }
  }
  return null;
 }
 return null;
}

代码示例来源:origin: EngineHub/CommandHelper

/**
 * Returns the ivariable from the lowest stack element. If the IVariable is not defined, null is returned.
 *
 * @param name
 * @return
 */
public IVariable getIVariableFromStack(String name) {
  ListIterator<Set<IVariable>> stackIterator = variableStack.listIterator(variableStack.size());
  while(stackIterator.hasPrevious()) {
    Set<IVariable> set = stackIterator.previous();
    for(IVariable v : set) {
      if(v.getVariableName().equals(name)) {
        return v;
      }
    }
  }
  return null;
}

代码示例来源:origin: com.js-lib/js-json

/**
   * Dump circular dependencies stack to error log but leave stack unchanged.
   * 
   * @param value current value object on which circular dependency was discovered.
   */
  private void dumpCircularDependenciesStack(Object value) {
    ListIterator<Object> it = circularDependenciesStack.listIterator(circularDependenciesStack.size());
    StringBuilder dump = new StringBuilder();
    while (it.hasPrevious()) {
      dump.append(Strings.concat("\t- ", it.previous().getClass().getName(), "\r\n"));
    }
    log.error("Circular dependecies on value object |%s|. Set it to null. Stack dump:\r\n%s", value.getClass().getName(), dump.toString());
  }
}

代码示例来源:origin: org.terracotta/terracotta-ee

private synchronized void addPendingAcquires(final LockWaiter waiter) {
 if (!waiter.isRejoinInProgress()) {
  Stack<PendingLockHold> reacquires = waiter.getReacquires();
  java.util.ListIterator<PendingLockHold> it = reacquires.listIterator(reacquires.size());
  while (it.hasPrevious()) {
   addLast(it.previous());
  }
 }
}

代码示例来源:origin: org.terracotta/terracotta-l1

private synchronized void addPendingAcquires(final LockWaiter waiter) {
 if (!waiter.isRejoinInProgress()) {
  Stack<PendingLockHold> reacquires = waiter.getReacquires();
  java.util.ListIterator<PendingLockHold> it = reacquires.listIterator(reacquires.size());
  while (it.hasPrevious()) {
   addLast(it.previous());
  }
 }
}

代码示例来源:origin: org.terracotta/terracotta-l1-ee

private synchronized void addPendingAcquires(final LockWaiter waiter) {
 if (!waiter.isRejoinInProgress()) {
  Stack<PendingLockHold> reacquires = waiter.getReacquires();
  java.util.ListIterator<PendingLockHold> it = reacquires.listIterator(reacquires.size());
  while (it.hasPrevious()) {
   addLast(it.previous());
  }
 }
}

代码示例来源:origin: net.sf.okapi.filters/okapi-filter-yaml

private String getKeyNames(Key key) {
  StringBuilder keyPath = new StringBuilder();
  
  if (!params.getUseKeyAsName()) {
    return null;
  }
  
  if (!params.getUseFullKeyPath()) {
    return key.getKeyName();
  }
  
  if (!keyStack.isEmpty()) {
    Iterator<Key> it = keyStack.listIterator();
    while (it.hasNext()) {
      Key k = it.next();
      if (k != null && !k.isEmpty()) {
        if (keyPath.length() > 0) {
          keyPath.append("/");
        }
        keyPath.append(k.getKeyName());
      }
    }            
  }
  
  return keyPath.toString();
}

代码示例来源:origin: io.snappydata/gemfirexd-core

Scope findOwningScope(int actualTableNumber) {
 //special handling so as to avoid picking up the TableQueryInfo at 0th index
 //  in case the dml being investigated is a subquery . without this check
 // the column will get associated with wrong Scope.
 if(actualTableNumber == 0) {
  return this.getScopeAt(0);
 }
 //Do not check in the current scope
 ListIterator<Scope> scopeItr = this.scopes.listIterator(this.scopeLevel);
 Scope found = null;
 while(scopeItr.hasPrevious()) {
  Scope scope = scopeItr.previous();
  DMLQueryInfo dqi = scope.getDMLQueryInfo();      
  if(dqi.getTableQueryInfo(actualTableNumber) != null) {
   found = scope;
   break;
  }
 }
 return found;    
}

代码示例来源:origin: io.snappydata/snappydata-store-core

Scope findOwningScope(int actualTableNumber) {
 //special handling so as to avoid picking up the TableQueryInfo at 0th index
 //  in case the dml being investigated is a subquery . without this check
 // the column will get associated with wrong Scope.
 if(actualTableNumber == 0) {
  return this.getScopeAt(0);
 }
 //Do not check in the current scope
 ListIterator<Scope> scopeItr = this.scopes.listIterator(this.scopeLevel);
 Scope found = null;
 while(scopeItr.hasPrevious()) {
  Scope scope = scopeItr.previous();
  DMLQueryInfo dqi = scope.getDMLQueryInfo();      
  if(dqi.getTableQueryInfo(actualTableNumber) != null) {
   found = scope;
   break;
  }
 }
 return found;    
}

相关文章