當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。