@Override public int hashCode() { return Long.hashCode(this.suffixLength); }
@Override public int hashCode() { return Long.hashCode(this.bytes); }
/** * Return the same value as {@link Long#hashCode(long)}}. * @deprecated as of Spring Framework 5.0, in favor of the native JDK 8 variant */ @Deprecated public static int hashCode(long lng) { return Long.hashCode(lng); }
/** * Return a hash code based on the contents of the specified array. * If {@code array} is {@code null}, this method returns 0. */ public static int nullSafeHashCode(@Nullable long[] array) { if (array == null) { return 0; } int hash = INITIAL_HASH; for (long element : array) { hash = MULTIPLIER * hash + Long.hashCode(element); } return hash; }
@Override public int hashCode() { return i.hashCode(); }
@Override public int hashCode() { int result = topic != null ? topic.hashCode() : 0; result = 31 * result + (partition != null ? partition.hashCode() : 0); result = 31 * result + (headers != null ? headers.hashCode() : 0); result = 31 * result + (key != null ? key.hashCode() : 0); result = 31 * result + (value != null ? value.hashCode() : 0); result = 31 * result + (timestamp != null ? timestamp.hashCode() : 0); return result; } }
@Override public int hashCode(Object value) { try { return toIntExact(Long.hashCode((long) hashCodeHandle.invokeExact(value))); } catch (Throwable t) { throwIfInstanceOf(t, Error.class); throwIfInstanceOf(t, PrestoException.class); throw new PrestoException(GENERIC_INTERNAL_ERROR, t); } }
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((getRoleId() == null) ? 0 : getRoleId().hashCode()); result = prime * result + ((getName() == null) ? 0 : getName().hashCode()); result = prime * result + ((getTitle() == null) ? 0 : getTitle().hashCode()); result = prime * result + ((getDescription() == null) ? 0 : getDescription().hashCode()); result = prime * result + ((getCtime() == null) ? 0 : getCtime().hashCode()); result = prime * result + ((getOrders() == null) ? 0 : getOrders().hashCode()); return result; } }
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((getSystemId() == null) ? 0 : getSystemId().hashCode()); result = prime * result + ((getName() == null) ? 0 : getName().hashCode()); result = prime * result + ((getCode() == null) ? 0 : getCode().hashCode()); result = prime * result + ((getDescription() == null) ? 0 : getDescription().hashCode()); result = prime * result + ((getCtime() == null) ? 0 : getCtime().hashCode()); result = prime * result + ((getOrders() == null) ? 0 : getOrders().hashCode()); return result; } }
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((getTopicId() == null) ? 0 : getTopicId().hashCode()); result = prime * result + ((getTitle() == null) ? 0 : getTitle().hashCode()); result = prime * result + ((getDescription() == null) ? 0 : getDescription().hashCode()); result = prime * result + ((getUrl() == null) ? 0 : getUrl().hashCode()); result = prime * result + ((getCtime() == null) ? 0 : getCtime().hashCode()); return result; } }
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((getOrganizationId() == null) ? 0 : getOrganizationId().hashCode()); result = prime * result + ((getPid() == null) ? 0 : getPid().hashCode()); result = prime * result + ((getName() == null) ? 0 : getName().hashCode()); result = prime * result + ((getDescription() == null) ? 0 : getDescription().hashCode()); result = prime * result + ((getCtime() == null) ? 0 : getCtime().hashCode()); return result; } }
@Test @Deprecated public void hashCodeWithLong() { long lng = 883L; int expected = (new Long(lng)).hashCode(); assertEquals(expected, ObjectUtils.hashCode(lng)); }
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((getPayInOrderId() == null) ? 0 : getPayInOrderId().hashCode()); result = prime * result + ((getPayVendorId() == null) ? 0 : getPayVendorId().hashCode()); result = prime * result + ((getPayMchId() == null) ? 0 : getPayMchId().hashCode()); result = prime * result + ((getAmount() == null) ? 0 : getAmount().hashCode()); result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode()); result = prime * result + ((getCtime() == null) ? 0 : getCtime().hashCode()); return result; } }
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((getPayOutOrderId() == null) ? 0 : getPayOutOrderId().hashCode()); result = prime * result + ((getPayMchId() == null) ? 0 : getPayMchId().hashCode()); result = prime * result + ((getPayVendorId() == null) ? 0 : getPayVendorId().hashCode()); result = prime * result + ((getAmount() == null) ? 0 : getAmount().hashCode()); result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode()); result = prime * result + ((getCtime() == null) ? 0 : getCtime().hashCode()); return result; } }
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((getMenuId() == null) ? 0 : getMenuId().hashCode()); result = prime * result + ((getPid() == null) ? 0 : getPid().hashCode()); result = prime * result + ((getName() == null) ? 0 : getName().hashCode()); result = prime * result + ((getUrl() == null) ? 0 : getUrl().hashCode()); result = prime * result + ((getTarget() == null) ? 0 : getTarget().hashCode()); result = prime * result + ((getOrders() == null) ? 0 : getOrders().hashCode()); return result; } }
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((getPayInOrderDetailId() == null) ? 0 : getPayInOrderDetailId().hashCode()); result = prime * result + ((getPayInOrderId() == null) ? 0 : getPayInOrderId().hashCode()); result = prime * result + ((getProductId() == null) ? 0 : getProductId().hashCode()); result = prime * result + ((getProductName() == null) ? 0 : getProductName().hashCode()); result = prime * result + ((getProductPrice() == null) ? 0 : getProductPrice().hashCode()); result = prime * result + ((getProductCount() == null) ? 0 : getProductCount().hashCode()); result = prime * result + ((getRemark() == null) ? 0 : getRemark().hashCode()); return result; } }
@Benchmark public long computePositionWithBitShifting() { return (int) ((Integer.toUnsignedLong(Long.hashCode(hashcode)) * hashTableSize) >> 32); }
@Benchmark public long computePositionWithDivision() { return (int) ((Integer.toUnsignedLong(Long.hashCode(hashcode)) * hashTableSize) / (1 << 32)); }
@GwtIncompatible // Long.hashCode returns different values in GWT. public void testHashCode() { for (long value : VALUES) { assertEquals("hashCode for " + value, ((Long) value).hashCode(), Longs.hashCode(value)); } }
@Test public void testHashCode() { final MutableLong mutNumA = new MutableLong(0); final MutableLong mutNumB = new MutableLong(0); final MutableLong mutNumC = new MutableLong(1); assertTrue(mutNumA.hashCode() == mutNumA.hashCode()); assertTrue(mutNumA.hashCode() == mutNumB.hashCode()); assertFalse(mutNumA.hashCode() == mutNumC.hashCode()); assertTrue(mutNumA.hashCode() == Long.valueOf(0).hashCode()); }