当前位置: 首页>>代码示例>>Java>>正文


Java Deque.removeFirst方法代码示例

本文整理汇总了Java中java.util.Deque.removeFirst方法的典型用法代码示例。如果您正苦于以下问题:Java Deque.removeFirst方法的具体用法?Java Deque.removeFirst怎么用?Java Deque.removeFirst使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.util.Deque的用法示例。


在下文中一共展示了Deque.removeFirst方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getPath

import java.util.Deque; //导入方法依赖的package包/类
@Override
public final String getPath() {
    FileNaming fileNaming = getFileName();
    Deque<String> stack = new ArrayDeque<String>();
    while (fileNaming != null) {
        stack.addFirst(fileNaming.getName());
        fileNaming = fileNaming.getParent();
    }
    String rootName = stack.removeFirst();
    if (BaseUtilities.isWindows()) {
        rootName = rootName.replace(File.separatorChar, '/');
        if(rootName.startsWith("//")) {  //NOI18N
            // UNC root like //computer/sharedFolder
            rootName += "/";  //NOI18N
        }
    }
    StringBuilder path = new StringBuilder();
    path.append(rootName);
    while (!stack.isEmpty()) {
        path.append(stack.removeFirst());
        if (!stack.isEmpty()) {
            path.append('/');  //NOI18N
        }
    }
    return path.toString();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:27,代码来源:BaseFileObj.java

示例2: clearFrom

import java.util.Deque; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public synchronized void clearFrom(Collection<String> roots) {
    Set<String> allDeps = new HashSet<String>();
    Deque<String> process = new LinkedList<String>();
    process.addAll(roots);
    while (!process.isEmpty()) {
        String x = process.removeFirst();
        allDeps.add(x);
        Object deps = dependencies.get(x);
        if (deps == null) {
            continue;
        }
        if (deps instanceof String) {
            process.add((String)deps);
        } else {
            process.addAll((Collection<String>)deps);
        }
    }
    dependencies.keySet().removeAll(allDeps);

    classInfos.keySet().removeAll(allDeps);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:23,代码来源:FxBeanCache.java

示例3: evaluateElements

import java.util.Deque; //导入方法依赖的package包/类
@Override
		public Iterator<Element> evaluateElements(EvaluationContext ctx, Element elt) {
			Collection<Element> result = new LinkedHashSet<Element>();
			Deque<Element> queue = new LinkedList<Element>();
			queue.addLast(elt);
//			System.err.println("elt = " + elt);
//			System.err.println("arc = " + arc);
			while (!queue.isEmpty()) {
				Element e = queue.removeFirst();
				result.add(e);
//				System.err.println("e = " + e);
				for (Element n : Iterators.loop(arcs.evaluateElements(ctx, e))) {
//					System.err.println("n = " + n);
					if (!result.contains(n)) {
						queue.addLast(n);
					}
				}
			}
			return result.iterator();
		}
 
开发者ID:Bibliome,项目名称:alvisnlp,代码行数:21,代码来源:PathLibrary.java

示例4: collectInputs

import java.util.Deque; //导入方法依赖的package包/类
private void collectInputs(Deque<NodeDef> parentNodeDefs, NodeDef nodeDef, Set<String> ops, Collection<Trail> trails){

		if(ops.contains(nodeDef.getOp())){
			trails.add(new Trail(parentNodeDefs, nodeDef));
		}

		List<String> inputNames = nodeDef.getInputList();
		for(String inputName : inputNames){
			NodeDef inputNodeDef = getNodeDef(inputName);

			parentNodeDefs.addFirst(inputNodeDef);

			collectInputs(parentNodeDefs, inputNodeDef, ops, trails);

			parentNodeDefs.removeFirst();
		}
	}
 
开发者ID:jpmml,项目名称:jpmml-tensorflow,代码行数:18,代码来源:SavedModel.java

示例5: doLoad

import java.util.Deque; //导入方法依赖的package包/类
private Optional<SelectedSnapshot> doLoad(final Deque<SnapshotMetadata> metadatas) throws IOException {
    SnapshotMetadata metadata = metadatas.removeFirst();
    File file = toSnapshotFile(metadata);

    LOG.debug("doLoad {}", file);

    try {
        Object data = deserialize(file);

        LOG.debug("deserialized data: {}", data);

        return Optional.of(new SelectedSnapshot(metadata, data));
    } catch (IOException e) {
        LOG.error("Error loading snapshot file {}, remaining attempts: {}", file, metadatas.size(), e);

        if (metadatas.isEmpty()) {
            throw e;
        }

        return doLoad(metadatas);
    }
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:23,代码来源:LocalSnapshotStore.java

示例6: getAllModuleDependencies

import java.util.Deque; //导入方法依赖的package包/类
public Set<ResolvedDependency> getAllModuleDependencies() {
    Set<ResolvedDependency> resolvedElements = new LinkedHashSet<ResolvedDependency>();
    Deque<ResolvedDependency> workQueue = new LinkedList<ResolvedDependency>();
    workQueue.addAll(loadTransientGraphResults(selectedArtifacts).getRootNode().getPublicView().getChildren());
    while (!workQueue.isEmpty()) {
        ResolvedDependency item = workQueue.removeFirst();
        if (resolvedElements.add(item)) {
            final Set<ResolvedDependency> children = item.getChildren();
            if (children != null) {
                workQueue.addAll(children);
            }
        }
    }
    return resolvedElements;
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:16,代码来源:DefaultLenientConfiguration.java

示例7: getSignificantIncommingString

import java.util.Deque; //导入方法依赖的package包/类
public static String getSignificantIncommingString(Instance in) {
    Set<Instance> processed = new HashSet<Instance>();
    String temp = null;
    Deque<Instance> fifo = new ArrayDeque<Instance>();
    fifo.add(in);

    while (!fifo.isEmpty()) {
        if (fifo.size() > 10) {
            Logger.getLogger(Utils.class.getName()).log(Level.FINE, "overflow in getSignificantIncommingString({0})", new Object[] { in });

            break;
        }

        Instance act = fifo.removeFirst();
        @SuppressWarnings("unchecked")
        List<Value> incoming = act.getReferences();

        for (Value v : incoming) {
            String rName = v.getDefiningInstance().getJavaClass().getName();

            if (temp == null) {
                temp = "<< " + rName; // there is at least some incoming ref
            }

            if (rName.startsWith("java.") || rName.startsWith("javax.")) { // NOI18N
                Instance i = v.getDefiningInstance();

                if (processed.add(i)) {
                    fifo.add(i);
                }
            } else { // Bingo!

                return rName;
            }
        }
    }

    return (temp == null) ? "unknown" : temp; // NOI18N
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:40,代码来源:Utils.java

示例8: findComponentByAnchorName

import java.util.Deque; //导入方法依赖的package包/类
@Nullable
private WXComponent findComponentByAnchorName(@NonNull WXComponent root, @NonNull String anchorName) {
  long start = 0;
  if (WXEnvironment.isApkDebugable()) {
    start = System.currentTimeMillis();
  }

  Deque<WXComponent> deque = new ArrayDeque<>();
  deque.add(root);
  while (!deque.isEmpty()) {
    WXComponent curComponent = deque.removeFirst();
    ImmutableDomObject object = curComponent.getDomObject();
    if (object != null) {
      String isAnchorSet = WXUtils.getString(object.getAttrs().get(anchorName), null);

      //hit
      if (isAnchorSet != null && isAnchorSet.equals("true")) {
        if (WXEnvironment.isApkDebugable()) {
          WXLogUtils.d("dragPerf", "findComponentByAnchorName time: " + (System.currentTimeMillis() - start) + "ms");
        }
        return curComponent;
      }
    }
    if (curComponent instanceof WXVContainer) {
      WXVContainer container = (WXVContainer) curComponent;
      for (int i = 0, len = container.childCount(); i < len; i++) {
        WXComponent child = container.getChild(i);
        deque.add(child);
      }
    }
  }

  if (WXEnvironment.isApkDebugable()) {
    WXLogUtils.d("dragPerf", "findComponentByAnchorName elapsed time: " + (System.currentTimeMillis() - start) + "ms");
  }
  return null;

}
 
开发者ID:weexext,项目名称:ucar-weex-core,代码行数:39,代码来源:BasicListComponent.java

示例9: aquire

import java.util.Deque; //导入方法依赖的package包/类
private DateFormat aquire(Locale locale)
{
	synchronized( mutex )
	{
		Deque<DateFormat> sp = getSubpool(locale);
		return !sp.isEmpty() ? sp.removeFirst() : dateFormatFactory.createDateFormat(locale);
	}
}
 
开发者ID:equella,项目名称:Equella,代码行数:9,代码来源:ThreadSafeSimpleDateFormat.java

示例10: examineBuildingsWithSunset

import java.util.Deque; //导入方法依赖的package包/类
public static Deque<BuildingWithHeight> examineBuildingsWithSunset(Iterator<Integer> sequence) {
    Deque<BuildingWithHeight> stack = new ArrayDeque<>();
    int c = 0;
    while (sequence.hasNext()) {
        Integer temp = sequence.next();
        while (stack.peekFirst()!=null && temp >= stack.peekFirst().height) {
            stack.removeFirst();
        }
        stack.addFirst(new BuildingWithHeight(c++,temp));
    }
    return stack;
}
 
开发者ID:gardncl,项目名称:elements-of-programming-interviews-solutions,代码行数:13,代码来源:ComputeBuildingsWithView.java

示例11: maybeAddDims

import java.util.Deque; //导入方法依赖的package包/类
/**
 * The compiler does not always preserve the concrete syntax of annotated array dimensions, and
 * mixed-notation array dimensions. Use look-ahead to preserve the original syntax.
 * <p>
 * <p>It is assumed that any number of regular dimension specifiers ({@code []} with no
 * annotations) may be present in the input.
 *
 * @param dimExpressions an ordered list of dimension expressions (e.g. the {@code 0} in {@code
 *                       new int[0]}
 * @param annotations    an ordered list of type annotations grouped by dimension (e.g. {@code
 *                       [[@A, @B], [@C]]} for {@code int @A [] @B @C []}
 */
private void maybeAddDims(
        Deque<ExpressionTree> dimExpressions, Deque<List<AnnotationTree>> annotations) {
    boolean lastWasAnnotation = false;
    while (builder.peekToken().isPresent()) {
        switch (builder.peekToken().get()) {
            case "@":
                if (annotations.isEmpty()) {
                    return;
                }
                List<AnnotationTree> dimAnnotations = annotations.removeFirst();
                if (dimAnnotations.isEmpty()) {
                    continue;
                }
                builder.breakToFill(" ");
                visitAnnotations(dimAnnotations, BreakOrNot.NO, BreakOrNot.NO);
                lastWasAnnotation = true;
                break;
            case "[":
                if (lastWasAnnotation) {
                    builder.breakToFill(" ");
                } else {
                    builder.breakToFill();
                }
                token("[");
                if (!builder.peekToken().get().equals("]")) {
                    scan(dimExpressions.removeFirst(), null);
                }
                token("]");
                lastWasAnnotation = false;
                break;
            default:
                return;
        }
    }
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:48,代码来源:JavaInputAstVisitor.java

示例12: call

import java.util.Deque; //导入方法依赖的package包/类
public Subscriber<? super T> call(Subscriber<? super T> subscriber) {
    final Deque<Object> deque = new ArrayDeque();
    final NotificationLite<T> notification = NotificationLite.instance();
    final TakeLastQueueProducer<T> producer = new TakeLastQueueProducer(notification, deque, subscriber);
    subscriber.setProducer(producer);
    final Subscriber<? super T> subscriber2 = subscriber;
    return new Subscriber<T>(subscriber) {
        public void onStart() {
            request(Long.MAX_VALUE);
        }

        public void onCompleted() {
            deque.offer(notification.completed());
            producer.startEmitting();
        }

        public void onError(Throwable e) {
            deque.clear();
            subscriber2.onError(e);
        }

        public void onNext(T value) {
            if (OperatorTakeLast.this.count != 0) {
                if (deque.size() == OperatorTakeLast.this.count) {
                    deque.removeFirst();
                }
                deque.offerLast(notification.next(value));
            }
        }
    };
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:32,代码来源:OperatorTakeLast.java

示例13: locateSubGraph

import java.util.Deque; //导入方法依赖的package包/类
private static ParseGraph locateSubGraph(final ParseGraph graph, final ParseValue value, final Deque<Token> definitions, final Token terminator, final ParseGraph result) {
    if (graph == EMPTY || graph.head == null) {
        return EMPTY;
    }

    final Token currentDefinition = graph.getDefinition();
    if (!definitions.isEmpty() && currentDefinition == definitions.peekFirst()) {
        // found a token in the path
        definitions.removeFirst();
    }

    ParseGraph resultGraph = result;
    if (definitions.isEmpty() && currentDefinition == terminator) {
        // found a deeper token matching the terminating token in the path (making the sub-graph smaller)
        resultGraph = graph;

        // in case we're not searching for a value at all, return immediately
        if (value == null) {
            return resultGraph;
        }
    }

    if (graph.head.isValue() && graph.head.asValue() == value && definitions.isEmpty()) {
        return resultGraph;
    }
    if (graph.head.isGraph()) {
        final ParseGraph headResult = locateSubGraph(graph.head.asGraph(), value, new ArrayDeque<>(definitions), terminator, resultGraph);
        if (headResult != EMPTY) {
            return headResult;
        }
    }
    return locateSubGraph(graph.tail, value, definitions, terminator, resultGraph);
}
 
开发者ID:NCSC-NL,项目名称:PEF,代码行数:34,代码来源:GraphUtil.java

示例14: getFieldList

import java.util.Deque; //导入方法依赖的package包/类
private static void getFieldList(Class clazz, List<String> fieldList, String prefix, Deque<Class> classStack) throws IntrospectionException {
    //To avoid recursion, bail out if the input Class has already been introspected
    if (classStack.contains(clazz)) {
        if (log.isDebugEnabled())
            log.debug("Fields from " + clazz + " prefixed by " + prefix + " will be ignored, since the class has already been introspected as per the stack " + classStack);
        return;
    } else
        classStack.addFirst(clazz);

    //Introspect the input Class
    BeanInfo beanInfo = Introspector.getBeanInfo(clazz);
    if (beanInfo != null) {
        PropertyDescriptor[] pds = beanInfo.getPropertyDescriptors();
        if (pds != null) {
            for (PropertyDescriptor pd : pds) {
                if (pd.getReadMethod() != null && pd.getWriteMethod() != null) {
                    String name = pd.getName();
                    String qualifieldName = prefix == null || prefix.length() == 0 ? name : prefix + '.' + name;
                    Class type = pd.getPropertyType();
                    if (type.isArray())
                        type = type.getComponentType();
                    if (type == String.class || type == Boolean.class || Number.class.isAssignableFrom(type) || IDateBase.class.isAssignableFrom(type) || Currency.class.isAssignableFrom(type) || type.isPrimitive() || type.isEnum())
                        fieldList.add(qualifieldName);
                    else
                        getFieldList(type, fieldList, qualifieldName, classStack);
                }
            }
        }
    }

    classStack.removeFirst();
}
 
开发者ID:jaffa-projects,项目名称:jaffa-framework,代码行数:33,代码来源:PropertyFilter.java

示例15: testShift

import java.util.Deque; //导入方法依赖的package包/类
@Test
public void testShift() throws ScriptException {
    final Deque<Object> l = getListAdapter();
    l.removeFirst();
    assertEquals(l.getFirst(), 2);
    assertEquals(l.getLast(), 4);
    assertEquals(l.size(), 3);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:9,代码来源:AddAndRemoveOnListAdapterOutsideOfJavaScriptContextTest.java


注:本文中的java.util.Deque.removeFirst方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。