@Override public synchronized boolean addAll(Collection<? extends V> c) { return delegate.addAll(c); }
/** * Update assigned variables in a temporary stack. */ private void updateCurrentScopeAssignedVariables() { // -@cs[MoveVariableInsideIf] assignment value is a modification call so it can't be moved final Deque<DetailAST> poppedScopeAssignedVariableData = currentScopeAssignedVariables.pop(); final Deque<DetailAST> currentScopeAssignedVariableData = currentScopeAssignedVariables.peek(); if (currentScopeAssignedVariableData != null) { currentScopeAssignedVariableData.addAll(poppedScopeAssignedVariableData); } }
void addValues(final HttpString name, Deque<String> value) { Deque<String> values = this.values.get(name); for(String i : value) { checkStringForSuspiciousCharacters(i); } if (values == null) { this.values.put(name, value); } else { values.addAll(value); } }
@Override public boolean addAll(Collection<? extends E> collection) { assertTrue(Thread.holdsLock(mutex)); return delegate.addAll(collection); }
@Override public ExecutionNode next() { ExecutionNode result = stack.poll(); stack.addAll(result.getChildren()); return result; }
public static Map<String, Deque<String>> mergeQueryParametersWithNewQueryString(final Map<String, Deque<String>> queryParameters, final String newQueryString, final String encoding) { Map<String, Deque<String>> newQueryParameters = parseQueryString(newQueryString, encoding); //according to the spec the new query parameters have to 'take precedence' for (Map.Entry<String, Deque<String>> entry : queryParameters.entrySet()) { if (!newQueryParameters.containsKey(entry.getKey())) { newQueryParameters.put(entry.getKey(), new ArrayDeque<>(entry.getValue())); } else { newQueryParameters.get(entry.getKey()).addAll(entry.getValue()); } } return newQueryParameters; }
public static Set<Class<?>> getImplementedInterfaces(Class<?> cl) { Set<Class<?>> interfaces = new HashSet<Class<?>>(); Deque<Class<?>> classes = new ArrayDeque<Class<?>>(); classes.add(cl); while (!classes.isEmpty()) { Class<?> c = classes.pop(); interfaces.addAll(Arrays.asList(c.getInterfaces())); if (c.getSuperclass() != null) { classes.add(c.getSuperclass()); } classes.addAll(Arrays.asList(c.getInterfaces())); } return interfaces; }
/** * Copy the stack for a parallel thread. * @return a copy. */ public LocalPropertyStack copy() { synchronized (LOCK) { LocalPropertyStack ret = new LocalPropertyStack(); ret.stack.addAll(stack); return ret; } }
private Pair splitWithNewBackReferenceLengthOf(int newBackReferenceLength) { Pair p = new Pair(); p.literals.addAll(literals); p.brOffset = brOffset; p.brLength = newBackReferenceLength; return p; } }
/** * Adds all of the elements in the specified collection at the end of this deque. * <p /> * Note: If collection being added can mutate concurrently, or underlying deque implementation allows partial * insertion, then subsequent calls to {@link #size()} can report incorrect value. * * @param col The elements to be inserted into this deque. * @return {@code true} if this deque changed as a result of the call. */ @Override public boolean addAll(@NotNull Collection<? extends E> col) { int colSize = col.size(); boolean res = deque.addAll(col); if (res) adder.add(colSize); return res; }
private void walkSubtree(Operator<?> root) { Deque<Operator<?>> deque = new LinkedList<>(); deque.add(root); while (!deque.isEmpty()) { Operator<?> op = deque.pollLast(); mark(op); if (op instanceof ReduceSinkOperator) { // Done with this branch } else { deque.addAll(op.getChildOperators()); } } }
private Set<Set<Operator<?>>> getComponents(OptimizeTezProcContext procCtx) { Deque<Operator<?>> deque = new LinkedList<Operator<?>>(); deque.addAll(procCtx.parseContext.getTopOps().values()); AtomicInteger index = new AtomicInteger(); Map<Operator<?>, Integer> indexes = new HashMap<Operator<?>, Integer>(); Map<Operator<?>, Integer> lowLinks = new HashMap<Operator<?>, Integer>(); Stack<Operator<?>> nodes = new Stack<Operator<?>>(); Set<Set<Operator<?>>> components = new LinkedHashSet<Set<Operator<?>>>(); for (Operator<?> o : deque) { if (!indexes.containsKey(o)) { connect(o, index, nodes, indexes, lowLinks, components, procCtx.parseContext); } } return components; }
public static Operator<?> findOperatorByMarker(Operator<?> start, String marker) { Deque<Operator<?>> queue = new ArrayDeque<>(); queue.add(start); while (!queue.isEmpty()) { Operator<?> op = queue.remove(); if (marker.equals(op.getMarker())) { return op; } if (op.getChildOperators() != null) { queue.addAll(op.getChildOperators()); } } return null; }
@Override public Queue<LinkedValue> create(LinkedValue[] elements) { Deque<LinkedValue> deque = useTarget ? supplier.get() : new ArrayDeque<>(); deque.addAll(MinimalCollection.of(elements)); useTarget = false; return deque; } })
Deque<String> asDeqeue(String... args) { Deque<String> dq = new ArrayDeque<>(); List<String> x = Arrays.asList(args); Collections.reverse(x); dq.addAll(x); return dq; } }
private void runDynamicPartitionPruning(OptimizeTezProcContext procCtx, Set<ReadEntity> inputs, Set<WriteEntity> outputs) throws SemanticException { if (!procCtx.conf.getBoolVar(ConfVars.TEZ_DYNAMIC_PARTITION_PRUNING)) { return; } // Sequence of TableScan operators to be walked Deque<Operator<?>> deque = new LinkedList<Operator<?>>(); deque.addAll(procCtx.parseContext.getTopOps().values()); Map<Rule, NodeProcessor> opRules = new LinkedHashMap<Rule, NodeProcessor>(); opRules.put( new RuleRegExp(new String("Dynamic Partition Pruning"), FilterOperator.getOperatorName() + "%"), new DynamicPartitionPruningOptimization()); // The dispatcher fires the processor corresponding to the closest matching // rule and passes the context along Dispatcher disp = new DefaultRuleDispatcher(null, opRules, procCtx); List<Node> topNodes = new ArrayList<Node>(); topNodes.addAll(procCtx.parseContext.getTopOps().values()); GraphWalker ogw = new ForwardWalker(disp); ogw.startWalking(topNodes, null); }
@Override public TestExecutor<T> andGivenCommands(List<?> commands) { finalizeConfiguration(); for (Object command : commands) { ExecutionExceptionAwareCallback callback = new ExecutionExceptionAwareCallback(); executeAtSimulatedTime(() -> commandBus.dispatch(GenericCommandMessage.asCommandMessage(command), callback)); callback.assertSuccessful(); givenEvents.addAll(storedEvents); storedEvents.clear(); } publishedEvents.clear(); return this; }
create().remove(); create().add("foo"); create().addAll(ImmutableList.of("foo")); create().clear(); create().contains("foo");