1
以下代码显示的错误是:无法将对象转换为整数。我不知道我还会包括什么来施放它。将Java对象转换为整数
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);
}
};
}
这将是一个“整数”(对象)而不是“整数”(原始)。为了更快地获得更好的帮助,请发布[SSCCE](http://sscce.org/)。 –
你可以把Entry的getidentifier方法签名? – BachT
@AndrewThompson如果它是一个Integer对象,那么这个代码不应该继续工作,因为它会自动取消装箱? – Hassan