我想根据表格元素的条目索引提供实际页面。我用PageRequest.of(int page, int size).
我将indexwhich 传递给函数,还有一个常量PAGESIZE_SEARCH50。
我想根据索引传递当前页面如下:
PageRequest.of((int) index/PAGESIZE_SEARCH, PAGESIZE_SEARCH)
我的想法(IntelliJ Ultimate 2020.1.1)使我的铸造和暗示变灰Casting 'index' to 'int' is redundant。如果我删除演员表,即使编译器接受它,我也不会得到运行时异常。
为什么是这样?那里的分区不安全吗?任何解释将不胜感激。