I have class:
public class GridResponse<V> {
public void setPage(int page) {
this.page = page;
}
}
And class implemented Comparator:
public class GridComparator<GridResponse> implements Comparator<GridResponse> {
@Override
public int compare(GridResponse o1, GridResponse o2) {
o1.setPage = '1';
return 0;
}
}
What is wrong in class GridComparator, because I don’t have access to function in GridResponse? Why?
The
GridComparatorclass should not be generic at all, it is specific for theGridResponseclass.