Error shown from the below code is: Cannot Cast an object to integer. I don't know what else will i include to cast it.
private RowFilter filter(final int itemsPerPage,final int target) {
return new RowFilter() {
public boolean include(Entry entry) {
/* HERE I AM RECEIVING ERROR: Multiple markers at this line
- Type mismatch: cannot convert from Object to int
- Cannot cast from Object to int */
int ei = (int) entry.getIdentifier();
return (target * itemsPerPage <= ei && ei < target
* itemsPerPage + itemsPerPage);
}
};
}
What you want is:
int ei = ((Integer) entry.getIdentifier()).intValue();