本文整理汇总了Java中java.util.HashSet.containsAll方法的典型用法代码示例。如果您正苦于以下问题:Java HashSet.containsAll方法的具体用法?Java HashSet.containsAll怎么用?Java HashSet.containsAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.util.HashSet
的用法示例。
在下文中一共展示了HashSet.containsAll方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: hasUniqueIndex
import java.util.HashSet; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private boolean hasUniqueIndex(Index index, Table table)
{
HashSet<Column> indexCols = new HashSet<Column>();
Iterator<Column> icolIter = index.getColumnIterator();
while( icolIter.hasNext() )
{
Column col = icolIter.next();
indexCols.add(col);
if( index.getColumnSpan() == 1 && table.getColumn(col).isUnique() )
{
return true;
}
}
Iterator<UniqueKey> iter = table.getUniqueKeyIterator();
while( iter.hasNext() )
{
UniqueKey uk = iter.next();
if( uk.getColumnSpan() == indexCols.size() && indexCols.containsAll(uk.getColumns()) )
{
return true;
}
}
return false;
}
示例2: includes
import java.util.HashSet; //导入方法依赖的package包/类
public static HashSet<String> includes(HashSet<String> toInclude, HashMap<HashSet<String>, HashSet<String>> mapping){
HashSet<String> relevantRecipes = new HashSet<String>();
for(HashSet<String> key:mapping.keySet()){
if(key.containsAll(toInclude)){ //make sure all items in toInclude are present
relevantRecipes.addAll(mapping.get(key));
}
}
return relevantRecipes;
}
示例3: isIncludedIn
import java.util.HashSet; //导入方法依赖的package包/类
@Override
public boolean isIncludedIn(SimpleColumnCombination a, SimpleColumnCombination b) {
HashSet<List<Long>> setA = sets.get(a.getTable()).get(a);
HashSet<List<Long>> setB = sets.get(b.getTable()).get(b);
this.numChecks++;
return setB.containsAll(setA);
}
示例4: checkColumns
import java.util.HashSet; //导入方法依赖的package包/类
private void checkColumns(String[] projection) {
if (projection != null) {
HashSet<String> availableColumns = new HashSet<>(Arrays.asList(
MoviesContract.MovieEntry.getColumns()));
HashSet<String> requestedColumns = new HashSet<>(Arrays.asList(projection));
if (!availableColumns.containsAll(requestedColumns)) {
throw new IllegalArgumentException("Unknown columns in projection.");
}
}
}
示例5: checkForInitialSet
import java.util.HashSet; //导入方法依赖的package包/类
private void checkForInitialSet(int i, ConcurrentMap testMap, Map initialSet) {
HashSet found = new HashSet(testMap.values());
if (!found.containsAll(initialSet.values())) {
HashSet missed = new HashSet(initialSet.values());
missed.removeAll(found);
fail("On run " + i + " did not find these elements of the initial set using the iterator "
+ missed);
}
}
示例6: generatePartitionedToPartitionedPlan
import java.util.HashSet; //导入方法依赖的package包/类
private SynthesizedPlanFragment[] generatePartitionedToPartitionedPlan() {
LOG.trace("Partition set: " + m_partitionsSeen);
ArrayList<SynthesizedPlanFragment> restorePlan = new ArrayList<SynthesizedPlanFragment>();
HashSet<Integer> coveredPartitions = new HashSet<Integer>();
Iterator<Integer> hosts = m_partitionsAtHost.keySet().iterator();
while (!coveredPartitions.containsAll(m_partitionsSeen)) {
if (!hosts.hasNext()) {
LOG.error("Ran out of hosts before covering all partitions with distributors");
return null;
}
/**
* Get the list of partitions on this host and remove all that were
* covered
*/
Integer nextHost = hosts.next();
Set<Pair<Integer, Integer>> partitionsAndOrigHosts = new HashSet<Pair<Integer, Integer>>(m_partitionsAtHost.get(nextHost));
Iterator<Pair<Integer, Integer>> removeCoveredIterator = partitionsAndOrigHosts.iterator();
List<Integer> uncoveredPartitionsAtHostList = new ArrayList<Integer>();
HashSet<Integer> originalHosts = new HashSet<Integer>();
while (removeCoveredIterator.hasNext()) {
Pair<Integer, Integer> p = removeCoveredIterator.next();
if (coveredPartitions.contains(p.getFirst())) {
removeCoveredIterator.remove();
} else {
coveredPartitions.add(p.getFirst());
uncoveredPartitionsAtHostList.add(p.getFirst());
originalHosts.add(p.getSecond());
}
}
SystemProcedureExecutionContext context = this.getSystemProcedureExecutionContext();
assert (context != null);
Host catalog_host = context.getHost();
Collection<Site> catalog_sites = CatalogUtil.getSitesForHost(catalog_host);
List<Integer> sitesAtHost = new ArrayList<Integer>();
List<Integer> partitionsAtHost = new ArrayList<Integer>();
for (Site catalog_site : catalog_sites) {
sitesAtHost.add(catalog_site.getId());
for(Partition pt : catalog_site.getPartitions()){
partitionsAtHost.add(pt.getId());
}
}
int originalHostsArray[] = new int[originalHosts.size()];
int qq = 0;
for (int originalHostId : originalHosts)
originalHostsArray[qq++] = originalHostId;
int uncoveredPartitionsAtHost[] = new int[uncoveredPartitionsAtHostList.size()];
for (int ii = 0; ii < uncoveredPartitionsAtHostList.size(); ii++) {
uncoveredPartitionsAtHost[ii] = uncoveredPartitionsAtHostList.get(ii);
}
/*
* Assigning the FULL workload to each site. At the actual host
* static synchronization in the procedure will ensure the work is
* distributed across every ES in a meaningful way.
*/
for (Integer partition : partitionsAtHost) {
restorePlan.add(constructDistributePartitionedTableFragment(partition, uncoveredPartitionsAtHost, originalHostsArray));
}
}
restorePlan.add(constructDistributePartitionedTableAggregatorFragment());
return restorePlan.toArray(new SynthesizedPlanFragment[0]);
}