本文整理汇总了Java中com.google.common.collect.ImmutableSortedMultiset.copyOf方法的典型用法代码示例。如果您正苦于以下问题:Java ImmutableSortedMultiset.copyOf方法的具体用法?Java ImmutableSortedMultiset.copyOf怎么用?Java ImmutableSortedMultiset.copyOf使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.common.collect.ImmutableSortedMultiset
的用法示例。
在下文中一共展示了ImmutableSortedMultiset.copyOf方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: resultsMatch
import com.google.common.collect.ImmutableSortedMultiset; //导入方法依赖的package包/类
private static boolean resultsMatch(QueryResult controlResult, QueryResult testResult, int precision)
{
SortedMultiset<List<Object>> control = ImmutableSortedMultiset.copyOf(rowComparator(precision), controlResult.getResults());
SortedMultiset<List<Object>> test = ImmutableSortedMultiset.copyOf(rowComparator(precision), testResult.getResults());
try {
return control.equals(test);
}
catch (TypesDoNotMatchException e) {
return false;
}
}
示例2: getResultsComparison
import com.google.common.collect.ImmutableSortedMultiset; //导入方法依赖的package包/类
public String getResultsComparison(int precision)
{
List<List<Object>> controlResults = controlResult.getResults();
List<List<Object>> testResults = testResult.getResults();
if (valid() || (controlResults == null) || (testResults == null)) {
return "";
}
Multiset<List<Object>> control = ImmutableSortedMultiset.copyOf(rowComparator(precision), controlResults);
Multiset<List<Object>> test = ImmutableSortedMultiset.copyOf(rowComparator(precision), testResults);
try {
Iterable<ChangedRow> diff = ImmutableSortedMultiset.<ChangedRow>naturalOrder()
.addAll(Iterables.transform(Multisets.difference(control, test), row -> new ChangedRow(Changed.REMOVED, row, precision)))
.addAll(Iterables.transform(Multisets.difference(test, control), row -> new ChangedRow(Changed.ADDED, row, precision)))
.build();
diff = Iterables.limit(diff, 100);
StringBuilder sb = new StringBuilder();
sb.append(format("Control %s rows, Test %s rows%n", control.size(), test.size()));
if (verboseResultsComparison) {
Joiner.on("\n").appendTo(sb, diff);
}
else {
sb.append("RESULTS DO NOT MATCH\n");
}
return sb.toString();
}
catch (TypesDoNotMatchException e) {
return e.getMessage();
}
}