Reference { @Override public int hashCode() { return (int) id; } @SuppressWarnings("unchecked")  Reference(P propoid);  Reference(Class<? extends P> type, long id); @Override boolean equals(Object o); @Override int hashCode(); Uri toUri(); String toString(); @SuppressWarnings("unchecked") static Reference<P> from(String string); static Reference<P> from(Uri uri); static Reference<P> from(Intent intent); Intent to(Intent intent); static Reference<P> from(Bundle arguments); Bundle to(Bundle arguments); final Class<? extends P> type; final long id; }
@Test public void testHashCode() { assertTrue(new Reference<Foo>(Foo.class, 1).hashCode() == new Reference<Foo>( Foo.class, 1).hashCode()); assertFalse(new Reference<Foo>(Foo.class, 1).hashCode() == new Reference<Foo>( Foo.class, 2).hashCode()); }