private void testSets() { // 静态工厂方法 Sets.newHashSet(); Sets.newHashSet(1, 2, 3); Sets.newHashSetWithExpectedSize(10); Sets.newHashSet(Lists.newArrayList(1, 2, 3)); Sets.newLinkedHashSet(); Sets.newLinkedHashSetWithExpectedSize(10); Sets.newLinkedHashSet(Lists.newArrayList(1, 2, 3)); Sets.newTreeSet(); Sets.newTreeSet(Lists.newArrayList(1, 2, 3)); Sets.newTreeSet(Ordering.natural()); // 集合运算(返回SetView) Sets.union(Sets.newHashSet(1, 2, 3), Sets.newHashSet(4, 5, 6)).toString(); // 取并集[1,2,3,4,5] Sets.intersection(Sets.newHashSet(1, 2, 3), Sets.newHashSet(3, 4, 5)); // 取交集[3] Sets.difference(Sets.newHashSet(1, 2, 3), Sets.newHashSet(3, 4, 5)); // 只在set1, 不在set2[1,2] Sets.symmetricDifference(Sets.newHashSet(1, 2, 3), Sets.newHashSet(3, 4, 5)); // 交集取反[1,2,4,5] // 其他工具方法 Sets.cartesianProduct(Lists.newArrayList(Sets.newHashSet(1, 2), Sets.newHashSet(3, 4))); // 返回所有集合的笛卡尔积 Sets.powerSet(Sets.newHashSet(1, 2, 3)); // 返回给定集合的所有子集 } }
throw new EthereumApiException("The contract " + contractInterface.getName() + " does not have the function(s) " + superfluous.toString() + ". Add this function(s) to the smart contract or remove it fromSeed your interface");
String message = String.format("The following one or more directories are used in both an input " + "section and an output section: \"%s\"\n", intersect.toString()); builder.append(message);
break; LOGGER.trace(newAxioms.toString());
if(!diff.isEmpty()) getLog().warn("Plugin artifactId(s) defined in 'versionOverrides' parameter but no associated entry found in <pluginManagement> section for " + diff.toString());
public void validateWritableRootPaths() { if (!validateDirs) { return; } for (StreamMapper phase : phases) { phase.validateWritableRootPaths(); } Set<Path>[] outputDirs = new Set[phases.length]; StringBuilder builder = new StringBuilder(); for (int i = 0; i < phases.length; i++) { if ((disable != null) && disable[i]) { continue; } outputDirs[i] = new HashSet<>(); outputDirs[i].addAll(phases[i].writableRootPaths()); for (int j = 0; j < i; j++) { Sets.SetView<Path> intersect = Sets.intersection(outputDirs[i], outputDirs[j]); if (intersect.size() > 0) { String message = String.format("Phases %d and %d have overlapping output directories: \"%s\"\n", (j + 1), (i + 1), intersect.toString()); builder.append(message); } } } if (builder.length() > 0) { throw new IllegalArgumentException(builder.toString()); } }
@Override public List<DAG> getTrees(Set<TreeId> ids) throws NoSuchElementException { List<DAG> cached = heap.getTrees(Sets.filter(ids, heapTrees)); List<DAG> res = cached; if (cached.size() < ids.size()) { if (disk != null) { List<DAG> stored = disk.getTrees(Sets.filter(ids, diskTrees)); res.addAll(stored); } } if (res.size() < ids.size()) { Set<TreeId> resids = Sets.newHashSet(Iterables.transform(res, (d) -> d.getId())); throw new NoSuchElementException(Sets.difference(ids, resids).toString()); } return res; }