TypeReference implements Comparable<TypeReference<T>> { @Override public boolean equals(Object other) { return this == other || (other instanceof TypeReference && getType().equals(((TypeReference<?>) other).getType())); } protected  TypeReference(); Type getType(); @Override int compareTo(@Nullable TypeReference<T> object); @Override int hashCode(); @Override boolean equals(Object other); @Override String toString();  }
@Test public void test_equals() { assertThat(ref.equals(ref), equalTo(true)); assertThat(ref.equals(new TypeReference<String>() { }), equalTo(true)); assertThat(ref.equals(null), equalTo(false)); assertThat(ref.equals(""), equalTo(false)); assertThat(ref.equals(new TypeReference<Boolean>() { }), equalTo(false)); }