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

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

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

Stack.subList介绍

暂无

代码示例

代码示例来源:origin: google/j2objc

private List<Matcher> popLastArgumentMatchers(int count) {
  List<Matcher> result = new LinkedList<Matcher>();
  result.addAll(matcherStack.subList(matcherStack.size() - count, matcherStack.size()));
  for (int i = 0; i < count; i++) {
    matcherStack.pop();
  }
  return result;
}

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

private void detectedCycle(N q) throws CycleDetectedException {
  int i = path.indexOf(q);
  path.push(q);
  reactOnCycle(q, path.subList(i, path.size()));
}

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

@Override
public void execute(ExecutionContext context)
{
  Stack<Object> stack = context.getStack();
  int n = ((Number)stack.pop()).intValue();
  if (n > 0)
  {
    int size = stack.size();
    //Need to copy to a new list to avoid ConcurrentModificationException
    List<Object> copy = new java.util.ArrayList<>(
        stack.subList(size - n, size));
    stack.addAll(copy);
  }
}

代码示例来源:origin: org.openl.rules/org.openl.rules.mapping.dev.dozer

public List<Object> getDestParents() {
  return dstObjects.subList(0, dstObjects.size());
}

代码示例来源:origin: org.openl.rules/org.openl.rules.mapping.dev.modified

public List<Object> getSourceParents() {
  return srcObjects.subList(0, srcObjects.size());
}

代码示例来源:origin: org.openl.rules/org.openl.rules.mapping.dev.dozer

public List<Object> getSourceParents() {
  return srcObjects.subList(0, srcObjects.size());
}

代码示例来源:origin: org.openl.rules/org.openl.rules.mapping.dev.modified

public List<Object> getDestParents() {
  return dstObjects.subList(0, dstObjects.size());
}

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

public void execute(ExecutionContext context)
{
  Stack<Object> stack = context.getStack();
  int n = ((Number)stack.pop()).intValue();
  if (n > 0)
  {
    int size = stack.size();
    //Need to copy to a new list to avoid ConcurrentModificationException
    List<Object> copy = new java.util.ArrayList<Object>(
        stack.subList(size - n, size));
    stack.addAll(copy);
  }
}

代码示例来源:origin: com.github.lafa.pdfbox/pdfbox

public void execute(ExecutionContext context)
{
  Stack<Object> stack = context.getStack();
  int n = ((Number)stack.pop()).intValue();
  if (n > 0)
  {
    int size = stack.size();
    //Need to copy to a new list to avoid ConcurrentModificationException
    List<Object> copy = new java.util.ArrayList<>(
        stack.subList(size - n, size));
    stack.addAll(copy);
  }
}

代码示例来源:origin: TomRoush/PdfBox-Android

public void execute(ExecutionContext context)
{
  Stack<Object> stack = context.getStack();
  int n = ((Number)stack.pop()).intValue();
  if (n > 0)
  {
    int size = stack.size();
    //Need to copy to a new list to avoid ConcurrentModificationException
    List<Object> copy = new java.util.ArrayList<Object>(
        stack.subList(size - n, size));
    stack.addAll(copy);
  }
}

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

private static List<IArgumentMatcher> popLastArgumentMatchers(int count) {
  Stack<IArgumentMatcher> stack = threadToArgumentMatcherStack.get(Thread
      .currentThread());
  assertState(stack != null, "no matchers found.");
  assertState(stack.size() >= count, "" + count + " matchers expected, "
      + stack.size() + " recorded.");
  List<IArgumentMatcher> result = new LinkedList<IArgumentMatcher>();
  result.addAll(stack.subList(stack.size() - count, stack.size()));
  for (int i = 0; i < count; i++) {
    stack.pop();
  }
  return result;
}

代码示例来源:origin: org.easymock/com.springsource.org.easymock

private static List<IArgumentMatcher> popLastArgumentMatchers(int count) {
  Stack<IArgumentMatcher> stack = threadToArgumentMatcherStack.get();
  assertState(stack != null, "no matchers found.");
  assertState(stack.size() >= count, "" + count + " matchers expected, "
      + stack.size() + " recorded.");
  List<IArgumentMatcher> result = new LinkedList<IArgumentMatcher>();
  result.addAll(stack.subList(stack.size() - count, stack.size()));
  for (int i = 0; i < count; i++) {
    stack.pop();
  }
  return result;
}

代码示例来源:origin: com.google.code.maven-play-plugin.com.google.code.eamelink-mockito/mockito-all

private List<Matcher> popLastArgumentMatchers(int count) {
  assertState(!matcherStack.isEmpty(), "No matchers found.");
  assertState(matcherStack.size() >= count,
      "" + count + " matchers expected, " + matcherStack.size() + " recorded.");
  List<Matcher> result = new LinkedList<Matcher>();
  result.addAll(matcherStack.subList(matcherStack.size() - count, matcherStack.size()));
  for (int i = 0; i < count; i++) {
    matcherStack.pop();
  }
  return result;
}

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

private void detectedCycle(N q) throws CycleDetectedException {
  int i = path.indexOf(q);
  path.push(q);
  reactOnCycle(q, path.subList(i, path.size()));
}

代码示例来源:origin: org.jvnet.hudson.main/hudson-core

private void detectedCycle(N q) throws CycleDetectedException {
  int i = path.indexOf(q);
  path.push(q);
  throw new CycleDetectedException(path.subList(i, path.size()));
}

代码示例来源:origin: hudson/hudson-2.x

private void detectedCycle(N q) throws CycleDetectedException {
  int i = path.indexOf(q);
  path.push(q);
  throw new CycleDetectedException(path.subList(i, path.size()));
}

代码示例来源:origin: org.eclipse.hudson/hudson-core

private void detectedCycle(N q) throws CycleDetectedException {
  int i = path.indexOf(q);
  path.push(q);
  throw new CycleDetectedException(path.subList(i, path.size()));
}

代码示例来源:origin: org.eclipse.hudson.main/hudson-core

private void detectedCycle(N q) throws CycleDetectedException {
  int i = path.indexOf(q);
  path.push(q);
  throw new CycleDetectedException(path.subList(i, path.size()));
}

代码示例来源:origin: com.github.sommeri/less4j

public List<Variable> getCycleFor(Variable input) {
 if (!wouldCycle(input))
  return Collections.emptyList();
 
 int position = names.indexOf(input.getName());
 List<Variable> result = new ArrayList<Variable>(variables.subList(position, variables.size()));
 result.add(input);
 return result;
}

代码示例来源:origin: org.icefaces/icefaces-mobi

public void setSelected(String selected){
  super.setSelected(selected);
  Stack<String> history = getHistory();
  if( history.size() == 1 && history.get(0).equals(selected)){
    return;
  }
  if( history.size() > 1 && getHistory().contains(selected)){
    Stack<String> newHistory = new Stack<String>();
    newHistory.addAll(getHistory().subList(0, getHistory().indexOf(selected)+1));
    setHistory(newHistory);
  }
  else {
    getHistory().push(selected);
  }
}

相关文章