/** Returns {@code true} if the second list is a permutation of the first. */ private static boolean isPermutation(List<?> first, List<?> second) { if (first.size() != second.size()) { return false; } Multiset<?> firstMultiset = HashMultiset.create(first); Multiset<?> secondMultiset = HashMultiset.create(second); return firstMultiset.equals(secondMultiset); } }
@Override public boolean equals(Object o) { if (o == this) { return true; } synchronized (mutex) { return delegate().equals(o); } }
/** Returns {@code true} if the second list is a permutation of the first. */ private static boolean isPermutation(List<?> first, List<?> second) { if (first.size() != second.size()) { return false; } Multiset<?> firstMultiset = HashMultiset.create(first); Multiset<?> secondMultiset = HashMultiset.create(second); return firstMultiset.equals(secondMultiset); } }
@Override public boolean equals(Object o) { if (o == this) { return true; } synchronized (mutex) { return delegate().equals(o); } }
@Override public boolean equals(@Nullable Object object) { return object == this || delegate().equals(object); }
public void testEquals_yes() { assertTrue( "multiset doesn't equal a multiset with the same elements", getMultiset().equals(HashMultiset.create(getSampleElements()))); }
@Override public boolean equals(Object o) { if (o == this) { return true; } synchronized (mutex) { return delegate().equals(o); } }
public void testEquals_differentSize() { Multiset<E> other = HashMultiset.create(getSampleElements()); other.add(e0()); assertFalse("multiset equals a multiset with a different size", getMultiset().equals(other)); }
public void sanityCheck() { Multiset<PlanFragmentId> exchangeIds = fragment.getRemoteSourceNodes().stream() .map(RemoteSourceNode::getSourceFragmentIds) .flatMap(List::stream) .collect(toImmutableMultiset()); Multiset<PlanFragmentId> childrenIds = children.stream() .map(SubPlan::getFragment) .map(PlanFragment::getId) .collect(toImmutableMultiset()); Preconditions.checkState(exchangeIds.equals(childrenIds), "Subplan exchange ids don't match child fragment ids (%s vs %s)", exchangeIds, childrenIds); for (SubPlan child : children) { child.sanityCheck(); } } }
@Override public boolean equals(@NullableDecl Object object) { return object == this || delegate().equals(object); }
@CollectionSize.Require(absent = ZERO) public void testEquals_differentElements() { Multiset<E> other = HashMultiset.create(getSampleElements()); other.remove(e0()); other.add(e3()); assertFalse("multiset equals a multiset with different elements", getMultiset().equals(other)); }
@Override public boolean equals(@NullableDecl Object object) { return object == this || delegate().equals(object); }
Multiset<String> conjsOp1String = extractConjsIgnoringDPPPreds(op1Conf.getPredicate()); Multiset<String> conjsOp2String = extractConjsIgnoringDPPPreds(op2Conf.getPredicate()); if (conjsOp1String.equals(conjsOp2String)) { equalFilters = true;
public void testToMultisetCountFunction() { BiPredicate<Multiset<String>, Multiset<String>> equivalence = (ms1, ms2) -> ms1.equals(ms2) && ImmutableList.copyOf(ms1.entrySet()) .equals(ImmutableList.copyOf(ms2.entrySet())); CollectorTester.of( Multisets.<Multiset.Entry<String>, String, Multiset<String>>toMultiset( Multiset.Entry::getElement, Multiset.Entry::getCount, LinkedHashMultiset::create), equivalence) .expectCollects(ImmutableMultiset.<String>of()) .expectCollects( ImmutableMultiset.of("a", "a", "b", "c", "c", "c"), Multisets.immutableEntry("a", 1), Multisets.immutableEntry("b", 1), Multisets.immutableEntry("a", 1), Multisets.immutableEntry("c", 3)); }
/** * Returns {@code true} if the second list is a permutation of the first. */ private static boolean isPermutation(List<?> first, List<?> second) { if (first.size() != second.size()) { return false; } Multiset<?> firstSet = HashMultiset.create(first); Multiset<?> secondSet = HashMultiset.create(second); return firstSet.equals(secondSet); }
@Override public boolean equals(Object o) { if (o == this) { return true; } synchronized (mutex) { return delegate().equals(o); } }
@Override public boolean equals(Object o) { if (o == this) { return true; } synchronized (mutex) { return delegate().equals(o); } }
@Override public boolean equals(Object o) { if (o == this) { return true; } synchronized (mutex) { return delegate().equals(o); } }
@Override public boolean equals(Object o) { if (o == this) { return true; } synchronized (mutex) { return delegate().equals(o); } }
public void testEquals_yes() { assertTrue( "multiset doesn't equal a multiset with the same elements", getMultiset().equals(HashMultiset.create(getSampleElements()))); }