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

How to use
Object
in
java.lang

Best Java code snippets using java.lang.Object (Showing top 20 results out of 467,919)

origin: ReactiveX/RxJava

/**
 * Appends the class name to a non-null value.
 * @param o the object
 * @return the string representation
 */
public static String valueAndClass(Object o) {
  if (o != null) {
    return o + " (class: " + o.getClass().getSimpleName() + ")";
  }
  return "null";
}
origin: ReactiveX/RxJava

  @Override
  public String toString() {
    return emitter.toString();
  }
}
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: ReactiveX/RxJava

  @Test
  public void validateSubscription() {
    BooleanSubscription bs1 = new BooleanSubscription();

    assertFalse(EndConsumerHelper.validate(SubscriptionHelper.CANCELLED, bs1, getClass()));

    assertTrue(bs1.isCancelled());

    assertTrue(errors.toString(), errors.isEmpty());
  }
}
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

private static void assertEqualTypeVariable(TypeVariable<?> expected, TypeVariable<?> actual) {
 assertEquals(expected.toString(), actual.toString());
 assertEquals(expected.getName(), actual.getName());
 assertEquals(expected.getGenericDeclaration(), actual.getGenericDeclaration());
 if (!Types.NativeTypeVariableEquals.NATIVE_TYPE_VARIABLE_ONLY) {
  assertEquals(actual.toString(), expected.hashCode(), actual.hashCode());
 }
 assertThat(actual.getBounds())
   .asList()
   .containsExactlyElementsIn(asList(expected.getBounds()))
   .inOrder();
}
origin: ReactiveX/RxJava

/**
 * Returns the hashCode of a non-null object or zero for a null object.
 * @param o the object to get the hashCode for.
 * @return the hashCode
 */
public static int hashCode(Object o) {
  return o != null ? o.hashCode() : 0;
}
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()));
  }
}
origin: ReactiveX/RxJava

@Test
public void validateDisposable() {
  Disposable d1 = Disposables.empty();
  assertFalse(EndConsumerHelper.validate(DisposableHelper.DISPOSED, d1, getClass()));
  assertTrue(d1.isDisposed());
  assertTrue(errors.toString(), errors.isEmpty());
}
origin: google/guava

private static void assertEqualWildcardType(WildcardType expected, WildcardType actual) {
 assertEquals(expected.toString(), actual.toString());
 assertEquals(actual.toString(), expected.hashCode(), actual.hashCode());
 assertThat(actual.getLowerBounds())
   .asList()
   .containsExactlyElementsIn(asList(expected.getLowerBounds()))
   .inOrder();
 assertThat(actual.getUpperBounds())
   .asList()
   .containsExactlyElementsIn(asList(expected.getUpperBounds()))
   .inOrder();
}
origin: ReactiveX/RxJava

@Override
public int hashCode() {
  Object o = value;
  return o != null ? o.hashCode() : 0;
}
origin: ReactiveX/RxJava

  @Override
  public String toString() {
    return String.format("%s{%s}", getClass().getSimpleName(), super.toString());
  }
}
origin: iluwatar/java-design-patterns

@Override
public String toString() {
 return val.toString();
}
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: ReactiveX/RxJava

@Override
public int hashCode() {
  return e.hashCode();
}
origin: ReactiveX/RxJava

  @Override
  public String toString() {
    return String.format("%s{%s}", getClass().getSimpleName(), super.toString());
  }
}
origin: google/guava

 @Override
 public String toString() {
  return '[' + element.toString() + ']';
 }
}
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 int hashCode() {
  return SequentialFunnel.class.hashCode() ^ elementFunnel.hashCode();
 }
}
origin: ReactiveX/RxJava

  @Override
  public String toString() {
    return String.format("%s{%s}", getClass().getSimpleName(), super.toString());
  }
}
java.langObject

Most used methods

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

Popular in Java

  • Making http post requests using okhttp
  • getSupportFragmentManager (FragmentActivity)
  • setRequestProperty (URLConnection)
  • findViewById (Activity)
  • GridBagLayout (java.awt)
    The GridBagLayout class is a flexible layout manager that aligns components vertically and horizonta
  • IOException (java.io)
    Signals a general, I/O-related error. Error details may be specified when calling the constructor, a
  • ReentrantLock (java.util.concurrent.locks)
    A reentrant mutual exclusion Lock with the same basic behavior and semantics as the implicit monitor
  • Collectors (java.util.stream)
  • DateTimeFormat (org.joda.time.format)
    Factory that creates instances of DateTimeFormatter from patterns and styles. Datetime formatting i
  • Runner (org.openjdk.jmh.runner)
  • Top Sublime Text plugins
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