/** * @return true if both list are the same, possibly in a different order */ public static <T extends EurekaEndpoint> boolean identical(List<T> firstList, List<T> secondList) { if (firstList.size() != secondList.size()) { return false; } HashSet<T> compareSet = new HashSet<>(firstList); compareSet.removeAll(secondList); return compareSet.isEmpty(); }
private HashSet<String> getColumnsWithoutData(Set<String> dataColumnsNames) { final HashSet<String> columnsCopy = new HashSet<>(columns); columnsCopy.removeAll(dataColumnsNames); return columnsCopy; }
/** * Get Set of pass members which haven't been assigned a position in the * pass. */ public Set<DetectorFactory> getUnpositionedMembers() { HashSet<DetectorFactory> result = new HashSet<>(memberSet); result.removeAll(orderedFactoryList); return result; }
public boolean removeAll(Collection<?> mocks) { return backingHashSet.removeAll(asWrappedMocks(mocks)); }
@Override public void nodesRemoved(Collection<DiscoveryDruidNode> nodes) { coordNodes.removeAll(nodes); } }
@Override public void nodesRemoved(Collection<DiscoveryDruidNode> nodes) { overlordNodes.removeAll(nodes); } }
/** * Merges two {@link ParameterTool}. * * @param other Other {@link ParameterTool} object * @return The Merged {@link ParameterTool} */ public ParameterTool mergeWith(ParameterTool other) { final Map<String, String> resultData = new HashMap<>(data.size() + other.data.size()); resultData.putAll(data); resultData.putAll(other.data); final ParameterTool ret = new ParameterTool(resultData); final HashSet<String> requestedParametersLeft = new HashSet<>(data.keySet()); requestedParametersLeft.removeAll(unrequestedParameters); final HashSet<String> requestedParametersRight = new HashSet<>(other.data.keySet()); requestedParametersRight.removeAll(other.unrequestedParameters); ret.unrequestedParameters.removeAll(requestedParametersLeft); ret.unrequestedParameters.removeAll(requestedParametersRight); return ret; }
public boolean removeAll(Collection<?> mocks) { return backingHashSet.removeAll(asWrappedMocks(mocks)); }
public static List<String> topicsListsMinus(List<String> list1, List<String> list2) { HashSet<String> s1 = new HashSet<>(list1); s1.removeAll(list2); return s1.stream().collect(Collectors.toList()); }
public static boolean equalSets(Collection<?> c1, Collection<?> c2) { if (c1 == null) { return c2 == null; } else if (c2 == null) { return false; } if (c1.size() != c2.size()) { return false; } HashSet<Object> set = new HashSet<>(c1); set.removeAll(c2); return (set.size() == 0); }
@ExpectWarning("GC_UNRELATED_TYPES") public boolean test2(HashSet<Integer> s1, HashSet<String> s2) { return s1.removeAll(s2); } }
@Override public void report() { emptyArray.removeAll(nonEmptyArray); for (XField f : emptyArray) { xFactory.addEmptyArrayField(f); } emptyArray.clear(); }
/** * Remove the names from the additions and deletions */ public void clear( final Set<String> names ) { this.deletions.removeAll( names ); clearAdditions( names ); }
private void notifyListenersOfRemovedPlugins(Set<PluginFileDetails> currentPluginFiles, Set<PluginFileDetails> previouslyKnownPluginFiles) { HashSet<PluginFileDetails> previouslyKnownPlugins = new HashSet<>(previouslyKnownPluginFiles); previouslyKnownPlugins.removeAll(currentPluginFiles); for (PluginFileDetails removedPluginFile : previouslyKnownPlugins) { doOnAllListeners().pluginJarRemoved(removedPluginFile); } }
private void notifyListenersOfAddedPlugins(Set<PluginFileDetails> currentPluginFiles, Set<PluginFileDetails> previouslyKnownPluginFiles) { HashSet<PluginFileDetails> currentPlugins = new HashSet<>(currentPluginFiles); currentPlugins.removeAll(previouslyKnownPluginFiles); for (PluginFileDetails newlyAddedPluginFile : currentPlugins) { doOnAllListeners().pluginJarAdded(newlyAddedPluginFile); } }
private static Set<TblColRef> unmatchedDimensions(Collection<TblColRef> dimensionColumns, CubeInstance cube) { HashSet<TblColRef> result = Sets.newHashSet(dimensionColumns); CubeDesc cubeDesc = cube.getDescriptor(); result.removeAll(cubeDesc.listDimensionColumnsIncludingDerived()); return result; }
/** {@inheritDoc} */ @Nullable @Override public Map<PartitionHashRecord, List<PartitionEntryHashRecord>> reduce(List<ComputeJobResult> results) throws IgniteException { Map<PartitionHashRecord, List<PartitionEntryHashRecord>> totalRes = new HashMap<>(); for (ComputeJobResult res : results) { Map<PartitionHashRecord, List<PartitionEntryHashRecord>> nodeRes = res.getData(); totalRes.putAll(nodeRes); } Set<PartitionEntryHashRecord> commonEntries = null; for (List<PartitionEntryHashRecord> nodeEntryHashRecords : totalRes.values()) { HashSet<PartitionEntryHashRecord> set = new HashSet<>(nodeEntryHashRecords); if (commonEntries == null) commonEntries = set; else commonEntries.retainAll(set); } if (commonEntries == null) return Collections.emptyMap(); Map<PartitionHashRecord, List<PartitionEntryHashRecord>> conflictsRes = new HashMap<>(); for (Map.Entry<PartitionHashRecord, List<PartitionEntryHashRecord>> e : totalRes.entrySet()) { HashSet<PartitionEntryHashRecord> conflicts = new HashSet<>(e.getValue()); conflicts.removeAll(commonEntries); if (!conflicts.isEmpty()) conflictsRes.put(e.getKey(), new ArrayList<>(conflicts)); } return conflictsRes; }
notFound.removeAll(allExtractors.keySet()); if (notFound.size() > 0) { throw new IllegalArgumentException(notFound + " columns are not supported");
public static void removeDeadBlocks(ControlFlowGraph graph) { LinkedList<BasicBlock> stack = new LinkedList<>(); HashSet<BasicBlock> setStacked = new HashSet<>(); stack.add(graph.getFirst()); setStacked.add(graph.getFirst()); while (!stack.isEmpty()) { BasicBlock block = stack.removeFirst(); List<BasicBlock> lstSuccs = new ArrayList<>(block.getSuccs()); lstSuccs.addAll(block.getSuccExceptions()); for (BasicBlock succ : lstSuccs) { if (!setStacked.contains(succ)) { stack.add(succ); setStacked.add(succ); } } } HashSet<BasicBlock> setAllBlocks = new HashSet<>(graph.getBlocks()); setAllBlocks.removeAll(setStacked); for (BasicBlock block : setAllBlocks) { graph.removeBlock(block); } }
private String buildDiffs() { final StringBuilder builder = new StringBuilder(); builder.append("acquired but not released:\n"); HashSet<String> keyDiff = new HashSet<>(acquiredCounts.keySet()); keyDiff.removeAll(releasedCounts.keySet()); keyDiff.forEach(k -> { builder.append(k).append("(").append(acquiredCounts.get(k)).append(")\n"); }); builder.append("released but not acquired:\n"); keyDiff.clear(); keyDiff.addAll(releasedCounts.keySet()); keyDiff.removeAll(acquiredCounts.keySet()); keyDiff.forEach(k -> { builder.append(k).append("(").append(releasedCounts.get(k)).append(")\n"); }); return builder.toString(); } }