本文整理匯總了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]);
}