@Override public boolean equals(Object obj) { if (obj instanceof Signature) { Signature that = (Signature) obj; return name.equals(that.name) && parameterTypes.equals(that.parameterTypes); } return false; }
@Override public boolean equals(@Nullable Object object) { // Warning: this is broken if size() == 0, so it is critical that we // substitute an empty ImmutableSet to the user in place of this if (object instanceof CartesianSet) { CartesianSet<?> that = (CartesianSet<?>) object; return this.axes.equals(that.axes); } return super.equals(object); }
Object readResolve() { if (ranges.isEmpty()) { return of(); } else if (ranges.equals(ImmutableList.of(Range.all()))) { return all(); } else { return new ImmutableRangeSet<C>(ranges); } } }
@Override public boolean equals(Object o) { if (o == this) { return true; } if (o instanceof UIntersectionClassType) { UIntersectionClassType that = (UIntersectionClassType) o; return (this.bounds.equals(that.bounds())); } return false; }
@Override public boolean equals(Object obj) { if (NativeTypeVariableEquals.NATIVE_TYPE_VARIABLE_ONLY) { // equal only to our TypeVariable implementation with identical bounds if (obj != null && Proxy.isProxyClass(obj.getClass()) && Proxy.getInvocationHandler(obj) instanceof TypeVariableInvocationHandler) { TypeVariableInvocationHandler typeVariableInvocationHandler = (TypeVariableInvocationHandler) Proxy.getInvocationHandler(obj); TypeVariableImpl<?> that = typeVariableInvocationHandler.typeVariableImpl; return name.equals(that.getName()) && genericDeclaration.equals(that.getGenericDeclaration()) && bounds.equals(that.bounds); } return false; } else { // equal to any TypeVariable implementation regardless of bounds if (obj instanceof TypeVariable) { TypeVariable<?> that = (TypeVariable<?>) obj; return name.equals(that.getName()) && genericDeclaration.equals(that.getGenericDeclaration()); } return false; } } }
Object readResolve() { if (ranges.isEmpty()) { return of(); } else if (ranges.equals(ImmutableList.of(Range.all()))) { return all(); } else { return new ImmutableRangeSet<C>(ranges); } } }
@Override public boolean equals(Object o) { if (o == this) { return true; } if (o instanceof UClassDecl.UnifierWithRemainingMembers) { UClassDecl.UnifierWithRemainingMembers that = (UClassDecl.UnifierWithRemainingMembers) o; return (this.unifier.equals(that.unifier())) && (this.remainingMembers.equals(that.remainingMembers())); } return false; }
@Override public boolean equals(Object other) { if (this == other) return true; else if (other == null) return false; else if (!getClass().isInstance(other)) return false; IndexQuery oth = (IndexQuery) other; return store.equals(oth.store) && orders.equals(oth.orders) && condition.equals(oth.condition) && getLimit() == oth.getLimit(); }
@Override public boolean equals(Object o) { if (o == this) { return true; } if (o instanceof UModifiers) { UModifiers that = (UModifiers) o; return (this.flagBits == that.flagBits()) && (this.getAnnotations.equals(that.getAnnotations())); } return false; }
@Override public GroupedExecutionProperties visitTableScan(TableScanNode node, Void context) { Optional<TablePartitioning> tablePartitioning = metadata.getLayout(session, node.getLayout().get()).getTablePartitioning(); if (!tablePartitioning.isPresent()) { return GroupedExecutionProperties.notCapable(); } List<ConnectorPartitionHandle> partitionHandles = nodePartitioningManager.listPartitionHandles(session, tablePartitioning.get().getPartitioningHandle()); if (ImmutableList.of(NOT_PARTITIONED).equals(partitionHandles)) { return new GroupedExecutionProperties(false, false, ImmutableList.of()); } else { return new GroupedExecutionProperties(true, false, ImmutableList.of(node.getId())); } }
public void testBuilderAddArrayHandlesNulls() { String[] elements = {"a", null, "b"}; ImmutableList.Builder<String> builder = ImmutableList.builder(); try { builder.add(elements); fail("Expected NullPointerException"); } catch (NullPointerException expected) { } ImmutableList<String> result = builder.build(); /* * Maybe it rejects all elements, or maybe it adds "a" before failing. * Either way is fine with us. */ if (result.isEmpty()) { return; } assertTrue(ImmutableList.of("a").equals(result)); assertEquals(1, result.size()); }
@Override public MatchResult detailMatches(PlanNode node, StatsProvider stats, Session session, Metadata metadata, SymbolAliases symbolAliases) { checkState(shapeMatches(node), "Plan testing framework error: shapeMatches returned false in detailMatches in %s", this.getClass().getName()); TableWriterNode tableWriterNode = (TableWriterNode) node; if (!tableWriterNode.getColumnNames().equals(columnNames)) { return NO_MATCH; } if (!columns.stream() .map(s -> Symbol.from(symbolAliases.get(s))) .collect(toImmutableList()) .equals(tableWriterNode.getColumns())) { return NO_MATCH; } return match(); }
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)); }
public void testToImmutableMultiset() { BiPredicate<ImmutableMultiset<String>, ImmutableMultiset<String>> equivalence = (ms1, ms2) -> ms1.equals(ms2) && ms1.entrySet().asList().equals(ms2.entrySet().asList()); CollectorTester.of(ImmutableMultiset.<String>toImmutableMultiset(), equivalence) .expectCollects(ImmutableMultiset.of()) .expectCollects( ImmutableMultiset.of("a", "a", "b", "c", "c", "c"), "a", "a", "b", "c", "c", "c"); }
public void testToImmutableSortedSet_customComparator() { Collector<String, ?, ImmutableSortedSet<String>> collector = ImmutableSortedSet.toImmutableSortedSet(String.CASE_INSENSITIVE_ORDER); BiPredicate<ImmutableSortedSet<String>, ImmutableSortedSet<String>> equivalence = (set1, set2) -> set1.equals(set2) && set1.asList().equals(set2.asList()) && set1.comparator().equals(set2.comparator()); ImmutableSortedSet<String> expected = ImmutableSortedSet.orderedBy(String.CASE_INSENSITIVE_ORDER).add("a", "B", "c", "d").build(); CollectorTester.of(collector, equivalence) .expectCollects(expected, "a", "B", "a", "c", "b", "b", "d"); }
public void testToImmutableMultisetCountFunction() { BiPredicate<ImmutableMultiset<String>, ImmutableMultiset<String>> equivalence = (ms1, ms2) -> ms1.equals(ms2) && ms1.entrySet().asList().equals(ms2.entrySet().asList()); CollectorTester.of( ImmutableMultiset.<Multiset.Entry<String>, String>toImmutableMultiset( Multiset.Entry::getElement, Multiset.Entry::getCount), equivalence) .expectCollects(ImmutableMultiset.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)); }
public void testToImmutableSortedMultisetCountFunction() { BiPredicate<ImmutableSortedMultiset<String>, ImmutableSortedMultiset<String>> equivalence = (ms1, ms2) -> ms1.equals(ms2) && ms1.entrySet().asList().equals(ms2.entrySet().asList()) && ms1.comparator().equals(ms2.comparator()); CollectorTester.of( ImmutableSortedMultiset.<String, String>toImmutableSortedMultiset( String.CASE_INSENSITIVE_ORDER, e -> e, e -> 1), equivalence) .expectCollects(ImmutableSortedMultiset.emptyMultiset(String.CASE_INSENSITIVE_ORDER)) .expectCollects( ImmutableSortedMultiset.orderedBy(String.CASE_INSENSITIVE_ORDER) .addCopies("a", 2) .addCopies("b", 1) .addCopies("c", 3) .build(), "a", "c", "b", "c", "A", "C"); }
public void testToImmutableSortedMultiset() { BiPredicate<ImmutableSortedMultiset<String>, ImmutableSortedMultiset<String>> equivalence = (ms1, ms2) -> ms1.equals(ms2) && ms1.entrySet().asList().equals(ms2.entrySet().asList()) && ms1.comparator().equals(ms2.comparator()); CollectorTester.of( ImmutableSortedMultiset.<String>toImmutableSortedMultiset( String.CASE_INSENSITIVE_ORDER), equivalence) .expectCollects(ImmutableSortedMultiset.emptyMultiset(String.CASE_INSENSITIVE_ORDER)) .expectCollects( ImmutableSortedMultiset.orderedBy(String.CASE_INSENSITIVE_ORDER) .addCopies("a", 2) .addCopies("b", 1) .addCopies("c", 3) .build(), "a", "c", "b", "c", "A", "C"); }