@Override public void forEach(Consumer<? super Entry<K, V>> action) { entries.forEach(action); }
@Override public void forEach(Consumer<? super E> action) { elements.forEach(action); }
@Override public void forEach(BiConsumer<? super K, ? super V> action) { checkNotNull(action); entries.forEach(e -> action.accept(e.getKey(), e.getValue())); }
@Override public void forEach(Consumer<? super E> action) { elements.forEach(action); }
@Override public void forEach(Consumer<? super Entry<K, V>> action) { entries.forEach(action); }
@GwtIncompatible // not present in emulated superclass @Override public void forEach(Consumer<? super E> action) { delegateList.forEach(action); }
@Override public void forEach(BiConsumer<? super K, ? super V> action) { checkNotNull(action); entries.forEach(e -> action.accept(e.getKey(), e.getValue())); }
public StageExecutionPlan plan(SubPlan root, Session session) { ImmutableList.Builder<SplitSource> allSplitSources = ImmutableList.builder(); try { return doPlan(root, session, allSplitSources); } catch (Throwable t) { allSplitSources.build().forEach(DistributedExecutionPlanner::closeSplitSource); throw t; } }
@Override public void forEach(BiConsumer<? super K, ? super V> action) { checkNotNull(action); entries.forEach(e -> action.accept(e.getKey(), e.getValue())); }
@GwtIncompatible // not present in emulated superclass @Override public void forEach(Consumer<? super E> action) { delegateList.forEach(action); }
public Map<String, String> asMap() { ImmutableMap.Builder<String, String> headers = ImmutableMap.builder(); entries().forEach(headers::put); return headers.build(); }
private void checkAllSourcesFinished() { checkNotHoldsLock(this); if (!sources.stream().allMatch(LocalExchangeSource::isFinished)) { return; } // all sources are finished, so finish the sinks ImmutableList<LocalExchangeSink> openSinks; synchronized (this) { allSourcesFinished = true; openSinks = ImmutableList.copyOf(sinks); sinks.clear(); } // since all sources are finished there is no reason to allow new pages to be added // this can happen with a limit query openSinks.forEach(LocalExchangeSink::finish); checkAllSinksComplete(); }
@Override public String toString() { if (tags.isEmpty()) { return name; } final StringBuilder buf = new StringBuilder(); buf.append(name).append('{'); tags.forEach(tag -> buf.append(tag.getKey()).append('=') .append(tag.getValue()).append(',')); buf.setCharAt(buf.length() - 1, '}'); return buf.toString(); } }
private synchronized void updateAllNodes(AllNodes allNodes) { if (includeCoordinator) { currentCount = allNodes.getActiveNodes().size(); } else { currentCount = Sets.difference(allNodes.getActiveNodes(), allNodes.getActiveCoordinators()).size(); } if (currentCount >= executionMinCount) { ImmutableList<SettableFuture<?>> listeners = ImmutableList.copyOf(futures); futures.clear(); executor.submit(() -> listeners.forEach(listener -> listener.set(null))); } } }
private static ImmutableSet<ResolvedArtifactResult> getArtifacts( Configuration configuration, Spec<ComponentIdentifier> filter, ImmutableList<String> artifactTypes) { ImmutableSet.Builder<ResolvedArtifactResult> artifactResultsBuilder = ImmutableSet.builder(); // We need to individually add these sets to the final set so as to maintain the order. // for eg. All aar artifact should come before jar artifacts. artifactTypes.forEach( artifactType -> artifactResultsBuilder.addAll( getArtifacts(configuration, artifactType, filter) .stream() .filter(it -> !it.getFile().getName().equals("classes.jar")) .collect(Collectors.toSet()))); return artifactResultsBuilder.build(); }
private void commonChecks(SetRequest request, Optional<ComponentDto> component) { checkValueIsSet(request); String settingKey = request.getKey(); SettingData settingData = new SettingData(settingKey, valuesFromRequest(request), component.orElse(null)); ImmutableList.of(validations.scope(), validations.qualifier(), validations.valueType()) .forEach(validation -> validation.accept(settingData)); component.map(ComponentDto::getBranch) .ifPresent(b -> checkArgument(SettingsWs.SETTING_ON_BRANCHES.contains(settingKey), format("Setting '%s' cannot be set on a branch", settingKey))); }
static Map<TextRange, String> getReplacements( Formatter formatter, String text, Collection<TextRange> ranges) { try { ImmutableMap.Builder<TextRange, String> replacements = ImmutableMap.builder(); formatter .getFormatReplacements(text, toRanges(ranges)) .forEach( replacement -> replacements.put( toTextRange(replacement.getReplaceRange()), replacement.getReplacementString())); return replacements.build(); } catch (FormatterException e) { return ImmutableMap.of(); } }
@Override public Description matchClass(ClassTree classTree, VisitorState state) { // collect all member methods and their indices in the list of members, grouped by name LinkedHashMultimap<OverloadKey, MemberWithIndex> methods = LinkedHashMultimap.create(); for (int i = 0; i < classTree.getMembers().size(); ++i) { Tree member = classTree.getMembers().get(i); if (member instanceof MethodTree) { MethodTree methodTree = (MethodTree) member; methods.put(OverloadKey.create(methodTree), MemberWithIndex.create(i, methodTree)); } } ImmutableList<Description> descriptions = methods.asMap().entrySet().stream() .flatMap( e -> checkOverloads( state, classTree.getMembers(), ImmutableList.copyOf(e.getValue()))) .collect(toImmutableList()); if (batchFindings && !descriptions.isEmpty()) { SuggestedFix.Builder fix = SuggestedFix.builder(); descriptions.forEach(d -> fix.merge((SuggestedFix) getOnlyElement(d.fixes))); return buildDescription(descriptions.get(0).position).addFix(fix.build()).build(); } descriptions.forEach(state::reportMatch); return NO_MATCH; }
public static void main(String[] args) { TpcdsStatisticsRecorder tool = new TpcdsStatisticsRecorder(new TableStatisticsRecorder(), new TableStatisticsDataRepository()); SUPPORTED_SCHEMAS.forEach(schemaName -> Table.getBaseTables().stream() .forEach(table -> tool.computeAndOutputStatsFor(schemaName, table))); }
public static void main(String[] args) { TpchStatisticsRecorder tool = new TpchStatisticsRecorder(new TableStatisticsRecorder(), new TableStatisticsDataRepository(createObjectMapper())); SUPPORTED_SCHEMAS.forEach(schemaName -> { TpchTable.getTables() .forEach(table -> tool.computeAndOutputStatsFor(schemaName, table)); Stream.of("F", "O", "P").forEach(partitionValue -> tool.computeAndOutputStatsFor(schemaName, ORDERS, ORDER_STATUS, partitionValue)); }); }