Tabnine Logo
Object.equals
Code IndexAdd Tabnine to your IDE (free)

How to use
equals
method
in
java.lang.Object

Best Java code snippets using java.lang.Object.equals (Showing top 20 results out of 190,917)

origin: ReactiveX/RxJava

/**
 * Compares two potentially null objects with each other using Object.equals.
 * @param o1 the first object
 * @param o2 the second object
 * @return the comparison result
 */
public static boolean equals(Object o1, Object o2) { // NOPMD
  return o1 == o2 || (o1 != null && o1.equals(o2));
}
origin: google/guava

 @Override
 public boolean equals(Object other) {
  if (other instanceof InternerFunction) {
   InternerFunction<?> that = (InternerFunction<?>) other;
   return interner.equals(that.interner);
  }
  return false;
 }
}
origin: square/retrofit

private static int indexOf(Object[] array, Object toFind) {
 for (int i = 0; i < array.length; i++) {
  if (toFind.equals(array[i])) return i;
 }
 throw new NoSuchElementException();
}
origin: square/okhttp

@Override public boolean equals(@Nullable Object other) {
 if (!(other instanceof Handshake)) return false;
 Handshake that = (Handshake) other;
 return tlsVersion.equals(that.tlsVersion)
   && cipherSuite.equals(that.cipherSuite)
   && peerCertificates.equals(that.peerCertificates)
   && localCertificates.equals(that.localCertificates);
}
origin: google/guava

@Override
public boolean equals(@Nullable Object object) {
 if (object instanceof Present) {
  Present<?> other = (Present<?>) object;
  return reference.equals(other.reference);
 }
 return false;
}
origin: square/okhttp

boolean equalsNonHost(Address that) {
 return this.dns.equals(that.dns)
   && this.proxyAuthenticator.equals(that.proxyAuthenticator)
   && this.protocols.equals(that.protocols)
   && this.connectionSpecs.equals(that.connectionSpecs)
   && this.proxySelector.equals(that.proxySelector)
   && Objects.equals(this.proxy, that.proxy)
   && Objects.equals(this.sslSocketFactory, that.sslSocketFactory)
   && Objects.equals(this.hostnameVerifier, that.hostnameVerifier)
   && Objects.equals(this.certificatePinner, that.certificatePinner)
   && this.url().port() == that.url().port();
}
origin: google/guava

@Override
public boolean equals(Object obj) {
 if (obj instanceof DummyHandler) {
  DummyHandler that = (DummyHandler) obj;
  return identity().equals(that.identity());
 } else {
  return false;
 }
}
origin: google/guava

static <K, V> ImmutableSortedMap<K, V> emptyMap(Comparator<? super K> comparator) {
 if (Ordering.natural().equals(comparator)) {
  return of();
 } else {
  return new ImmutableSortedMap<>(
    ImmutableSortedSet.emptySet(comparator), ImmutableList.<V>of());
 }
}
origin: google/guava

@Override
public boolean equals(@Nullable Object obj) {
 if (obj instanceof HasAnInterface) {
  HasAnInterface that = (HasAnInterface) obj;
  return i.equals(that.i);
 } else {
  return false;
 }
}
origin: google/guava

@Override
public boolean equals(@Nullable Object obj) {
 // In general getClass().isInstance() is bad for equals.
 // But here we fully control the subclasses to ensure symmetry.
 if (getClass().isInstance(obj)) {
  Wrapper that = (Wrapper) obj;
  return wrapped.equals(that.wrapped);
 }
 return false;
}
origin: google/guava

@MapFeature.Require({SUPPORTS_PUT, ALLOWS_NULL_VALUES})
@CollectionSize.Require(absent = ZERO)
public void testSetValueWithNullValuesPresent() {
 for (Entry<K, V> entry : getMap().entrySet()) {
  if (entry.getKey().equals(k0())) {
   assertEquals("entry.setValue() should return the old value", v0(), entry.setValue(null));
   break;
  }
 }
 expectReplacement(entry(k0(), (V) null));
}
origin: ReactiveX/RxJava

@Override
public void onNext(Object t) {
  if (t.equals(1)) {
    HalfSerializer.onNext(a[0], 2, wip, error);
  }
  ts.onNext(t);
}
origin: ReactiveX/RxJava

@Override
public void onNext(Object t) {
  if (t.equals(1)) {
    HalfSerializer.onNext(a[0], 2, wip, error);
  }
  to.onNext(t);
}
origin: ReactiveX/RxJava

@Override
public void onNext(Object t) {
  if (t.equals(1)) {
    HalfSerializer.onComplete(a[0], wip, error);
  }
  ts.onNext(t);
}
origin: ReactiveX/RxJava

@Override
public void onNext(Object t) {
  if (t.equals(1)) {
    HalfSerializer.onComplete(a[0], wip, error);
  }
  to.onNext(t);
}
origin: google/guava

@MapFeature.Require(SUPPORTS_PUT)
@CollectionSize.Require(absent = ZERO)
public void testSetValue() {
 for (Entry<K, V> entry : getMap().entrySet()) {
  if (entry.getKey().equals(k0())) {
   assertEquals("entry.setValue() should return the old value", v0(), entry.setValue(v3()));
   break;
  }
 }
 expectReplacement(entry(k0(), v3()));
}
origin: google/guava

@GwtIncompatible // ImmutableSortedSet.indexOf
// TODO(cpovirk): consider manual binary search under GWT to preserve O(log N) lookup
@Override
public int indexOf(@Nullable Object target) {
 int index = delegateCollection().indexOf(target);
 // TODO(kevinb): reconsider if it's really worth making feeble attempts at
 // sanity for inconsistent comparators.
 // The equals() check is needed when the comparator isn't compatible with
 // equals().
 return (index >= 0 && get(index).equals(target)) ? index : -1;
}
origin: ReactiveX/RxJava

@Override
public void onNext(Object t) {
  if (t.equals(1)) {
    HalfSerializer.onError(a[0], new TestException(), wip, error);
  }
  ts.onNext(t);
}
origin: ReactiveX/RxJava

@Override
public void onNext(Object t) {
  if (t.equals(1)) {
    HalfSerializer.onError(a[0], new TestException(), wip, error);
  }
  to.onNext(t);
}
origin: ReactiveX/RxJava

  @Test
  public void errorNotificationCompare() {
    TestException ex = new TestException();
    Object n1 = NotificationLite.error(ex);

    assertEquals(ex.hashCode(), n1.hashCode());

    assertFalse(n1.equals(NotificationLite.complete()));
  }
}
java.langObjectequals

Popular methods of Object

  • getClass
  • toString
  • hashCode
  • wait
  • notifyAll
  • clone
  • <init>
  • notify
  • finalize

Popular in Java

  • Creating JSON documents from java classes using gson
  • getSupportFragmentManager (FragmentActivity)
  • setScale (BigDecimal)
  • requestLocationUpdates (LocationManager)
  • Thread (java.lang)
    A thread is a thread of execution in a program. The Java Virtual Machine allows an application to ha
  • Deque (java.util)
    A linear collection that supports element insertion and removal at both ends. The name deque is shor
  • HttpServletRequest (javax.servlet.http)
    Extends the javax.servlet.ServletRequest interface to provide request information for HTTP servlets.
  • JCheckBox (javax.swing)
  • Loader (org.hibernate.loader)
    Abstract superclass of object loading (and querying) strategies. This class implements useful common
  • DateTimeFormat (org.joda.time.format)
    Factory that creates instances of DateTimeFormatter from patterns and styles. Datetime formatting i
  • Top plugins for WebStorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now