I want to use an interface like this :
public interface ResultItem {
public int getConfidence();
public boolean equals(ResultItem item);
public R
Well, you could make it generic:
public interface ResultItem> {
public boolean equals(ResultItem item);
}
Then you would need to make IntResult implement ResultItem.
Of course that doesn't stop another class from misbehaving, e.g. FloatResult implementing ResultItem but it makes various bits of API work when all the classes are well behaved.