1.边界限定
不要写 if else 了,使用Math.min 和Math.max,如AdapterView -- findSyncPosition()代码:
seed = Math.max(0, seed); seed = Math.min(count - 1, seed);
1.边界限定
不要写 if else 了,使用Math.min 和Math.max,如AdapterView -- findSyncPosition()代码:
seed = Math.max(0, seed); seed = Math.min(count - 1, seed);