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

How to use
hashCode
method
in
java.lang.Object

Best Java code snippets using java.lang.Object.hashCode (Showing top 20 results out of 95,778)

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

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

/** An implementation of {@link List#hashCode()}. */
static int hashCodeImpl(List<?> list) {
 // TODO(lowasser): worth optimizing for RandomAccess?
 int hashCode = 1;
 for (Object o : list) {
  hashCode = 31 * hashCode + (o == null ? 0 : o.hashCode());
  hashCode = ~~hashCode;
  // needed to deal with GWT integer overflow
 }
 return hashCode;
}
origin: google/guava

/** An implementation for {@link Set#hashCode()}. */
static int hashCodeImpl(Set<?> s) {
 int hashCode = 0;
 for (Object o : s) {
  hashCode += o != null ? o.hashCode() : 0;
  hashCode = ~~hashCode;
  // Needed to deal with unusual integer overflow in GWT.
 }
 return hashCode;
}
origin: ReactiveX/RxJava

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

 @Override
 public int hashCode() {
  return SequentialFunnel.class.hashCode() ^ elementFunnel.hashCode();
 }
}
origin: square/retrofit

@Override public int hashCode() {
 return Arrays.hashCode(typeArguments)
   ^ rawType.hashCode()
   ^ (ownerType != null ? ownerType.hashCode() : 0);
}
origin: google/guava

@Override
public int hashCode() {
 return (ownerType == null ? 0 : ownerType.hashCode())
   ^ argumentsList.hashCode()
   ^ rawType.hashCode();
}
origin: google/guava

@Override
public int hashCode() {
 int hashCode = 1;
 int n = size();
 for (int i = 0; i < n; i++) {
  hashCode = 31 * hashCode + get(i).hashCode();
  hashCode = ~~hashCode;
  // needed to deal with GWT integer overflow
 }
 return hashCode;
}
origin: ReactiveX/RxJava

@Override
public int hashCode() {
   int h = value != null ? value.hashCode() : 0;
   h = h * 31 + (int)((time >>> 31) ^ time);
   h = h * 31 + unit.hashCode();
   return h;
}
origin: square/okhttp

@Override public int hashCode() {
 int result = 17;
 result = 31 * result + tlsVersion.hashCode();
 result = 31 * result + cipherSuite.hashCode();
 result = 31 * result + peerCertificates.hashCode();
 result = 31 * result + localCertificates.hashCode();
 return result;
}
origin: google/guava

@Override
public int hashCode() {
 K k = getKey();
 V v = getValue();
 return ((k == null) ? 0 : k.hashCode()) ^ ((v == null) ? 0 : v.hashCode());
}
origin: google/guava

@Override
public int hashCode() {
 K k = getKey();
 V v = getValue();
 return ((k == null) ? 0 : k.hashCode()) ^ ((v == null) ? 0 : v.hashCode());
}
origin: google/guava

 @Override
 public int hashCode() {
  return i.hashCode();
 }
}
origin: google/guava

 @Override
 public Integer apply(Object o) {
  return (o == null) ? 0 : o.hashCode();
 }
}
origin: google/guava

public void testHashCode() {
 int expectedHashCode = 1;
 for (E element : getOrderedElements()) {
  expectedHashCode = 31 * expectedHashCode + ((element == null) ? 0 : element.hashCode());
 }
 assertEquals(
   "A List's hashCode() should be computed from those of its elements.",
   expectedHashCode,
   getList().hashCode());
}
origin: google/guava

public void testHashCode() {
 int expectedHashCode = 0;
 for (E element : getSampleElements()) {
  expectedHashCode += ((element == null) ? 0 : element.hashCode());
 }
 assertEquals(
   "A Set's hashCode() should be the sum of those of its elements.",
   expectedHashCode,
   getSet().hashCode());
}
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: google/guava

 @CollectionSize.Require(ONE)
 public void testHashCode_size1() {
  assertEquals("multiset has incorrect hash code", 1 ^ e0().hashCode(), getMultiset().hashCode());
 }
}
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.langObjecthashCode

Popular methods of Object

  • getClass
  • toString
  • equals
  • 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)
  • Best IntelliJ 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