public void testHashCode() { final MutableBoolean mutBoolA = new MutableBoolean(false); final MutableBoolean mutBoolB = new MutableBoolean(false); final MutableBoolean mutBoolC = new MutableBoolean(true); assertEquals(true, mutBoolA.hashCode() == mutBoolA.hashCode()); assertEquals(true, mutBoolA.hashCode() == mutBoolB.hashCode()); assertEquals(false, mutBoolA.hashCode() == mutBoolC.hashCode()); assertEquals(true, mutBoolA.hashCode() == Boolean.FALSE.hashCode()); assertEquals(true, mutBoolC.hashCode() == Boolean.TRUE.hashCode()); }
public BitmapMemoryCacheKey( String sourceString, @Nullable ResizeOptions resizeOptions, boolean autoRotated, ImageDecodeOptions imageDecodeOptions) { mSourceString = Preconditions.checkNotNull(sourceString); mResizeOptions = resizeOptions; mAutoRotated = autoRotated; mImageDecodeOptions = imageDecodeOptions; mHash = HashCodeUtil.hashCode( sourceString.hashCode(), (resizeOptions != null) ? resizeOptions.hashCode() : 0, autoRotated ? Boolean.TRUE.hashCode() : Boolean.FALSE.hashCode(), mImageDecodeOptions); }
/** * Returns a suitable hash code for this mutable. * * @return the hash code returned by <code>Boolean.TRUE</code> or <code>Boolean.FALSE</code> */ public int hashCode() { return value ? Boolean.TRUE.hashCode() : Boolean.FALSE.hashCode(); }