本文整理汇总了Java中com.google.common.collect.Sets.powerSet方法的典型用法代码示例。如果您正苦于以下问题:Java Sets.powerSet方法的具体用法?Java Sets.powerSet怎么用?Java Sets.powerSet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.common.collect.Sets
的用法示例。
在下文中一共展示了Sets.powerSet方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initPowersetIterator
import com.google.common.collect.Sets; //导入方法依赖的package包/类
private void initPowersetIterator() {
// Create set of definition with leftover quantities
Set<T> leftOverQuantities = new HashSet<>();
for (T def : allDefintions) {
if (roundSize.get(def) < def.numberOfLicenses()) {
leftOverQuantities.add(def);
}
}
if (leftOverQuantities.size() == 0) {
hasNext = false;
return;
} else {
hasNext = true;
Set<Set<T>> definitionPowerset = Sets.powerSet(leftOverQuantities);
List<Set<T>> sorted = new ArrayList<>(definitionPowerset);
sorted.sort(getIncreasingSizeComparator());
definitionPowersetIterator = sorted.iterator();
}
}
示例2: initPowersetIterator
import com.google.common.collect.Sets; //导入方法依赖的package包/类
private void initPowersetIterator() {
// Create set of definition with leftover quantities
Set<T> leftOverQuantities = new HashSet<>();
for (T def : allDefintions) {
if (roundSize.get(def) > 0) {
leftOverQuantities.add(def);
}
}
if (leftOverQuantities.size() == 0) {
hasNext = false;
return;
} else {
hasNext = true;
Set<Set<T>> definitionPowerset = Sets.powerSet(leftOverQuantities);
List<Set<T>> sorted = new ArrayList<>(definitionPowerset);
sorted.sort(getIncreasingSizeComparator());
definitionPowersetIterator = sorted.iterator();
}
}
示例3: generalizeSet
import com.google.common.collect.Sets; //导入方法依赖的package包/类
private Set<Set<ColumnIdentifier>> generalizeSet(Set<Set<ColumnIdentifier>> possibleSmallerIND) {
Set<Set<ColumnIdentifier>> generalizedINDs = new HashSet<>();
for(Set<ColumnIdentifier> indNode : possibleSmallerIND) {
Set<Set<ColumnIdentifier>> powerSet = new HashSet<>(Sets.powerSet(indNode));
powerSet.removeIf(x -> x.size() != indNode.size() - 1);
generalizedINDs.addAll(powerSet);
}
return generalizedINDs;
}