Whenever you override equals, you also need to override the hashCode() method, which will be used in the implementation of distinct().
In this case, you could just use
@Override public int hashCode() {
return test.charAt(0);
}
…which would work just fine.