java.util.HashSet.removeAll()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(7.5k)|赞(0)|评价(0)|浏览(162)

本文整理了Java中java.util.HashSet.removeAll()方法的一些代码示例,展示了HashSet.removeAll()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。HashSet.removeAll()方法的具体详情如下:
包路径:java.util.HashSet
类名称:HashSet
方法名:removeAll

HashSet.removeAll介绍

暂无

代码示例

代码示例来源:origin: Netflix/eureka

/**
 * @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();
}

代码示例来源:origin: twosigma/beakerx

private HashSet<String> getColumnsWithoutData(Set<String> dataColumnsNames) {
 final HashSet<String> columnsCopy = new HashSet<>(columns);
 columnsCopy.removeAll(dataColumnsNames);
 return columnsCopy;
}

代码示例来源:origin: spotbugs/spotbugs

/**
 * 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;
}

代码示例来源:origin: org.mockito/mockito-core

public boolean removeAll(Collection<?> mocks) {
  return backingHashSet.removeAll(asWrappedMocks(mocks));
}

代码示例来源:origin: apache/incubator-druid

@Override
 public void nodesRemoved(Collection<DiscoveryDruidNode> nodes)
 {
  coordNodes.removeAll(nodes);
 }
}

代码示例来源:origin: apache/incubator-druid

@Override
 public void nodesRemoved(Collection<DiscoveryDruidNode> nodes)
 {
  overlordNodes.removeAll(nodes);
 }
}

代码示例来源:origin: apache/flink

/**
 * 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;
}

代码示例来源:origin: google/j2objc

public boolean removeAll(Collection<?> mocks) {
  return backingHashSet.removeAll(asWrappedMocks(mocks));
}

代码示例来源:origin: apache/pulsar

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());
}

代码示例来源:origin: fesh0r/fernflower

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);
}

代码示例来源:origin: spotbugs/spotbugs

@ExpectWarning("GC_UNRELATED_TYPES")
  public boolean test2(HashSet<Integer> s1, HashSet<String> s2) {
    return s1.removeAll(s2);
  }
}

代码示例来源:origin: spotbugs/spotbugs

@Override
public void report() {
  emptyArray.removeAll(nonEmptyArray);
  for (XField f : emptyArray) {
    xFactory.addEmptyArrayField(f);
  }
  emptyArray.clear();
}

代码示例来源:origin: apache/usergrid

/**
 * Remove the names from the additions and deletions
 */
public void clear( final Set<String> names ) {
  this.deletions.removeAll( names );
  clearAdditions( names );
}

代码示例来源:origin: gocd/gocd

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);
  }
}

代码示例来源:origin: gocd/gocd

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);
  }
}

代码示例来源:origin: apache/kylin

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;
}

代码示例来源:origin: apache/ignite

/** {@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;
}

代码示例来源:origin: apache/storm

notFound.removeAll(allExtractors.keySet());
if (notFound.size() > 0) {
  throw new IllegalArgumentException(notFound + " columns are not supported");

代码示例来源:origin: fesh0r/fernflower

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);
 }
}

代码示例来源:origin: OpenHFT/Chronicle-Queue

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();
  }
}

相关文章