Code snippet from MultipleSelectionModelBase.java, function public void clearSelection() , line 630:
List<Integer> removed = new AbstractList<Integer>() {
final BitSet clone = (BitSet) selectedIndices.clone();
@Override public Integer get(int index) {
return clone.nextSetBit(index);
}
@Override public int size() {
return clone.cardinality();
}
};
Suppose indices 2 and 3 were selected before the call.
The removed list as implemented above will look like [2, 2] instead of [2, 3] which should be obvious from the code.
Why not use createListFromBitSet(...) as in clearAndSelect() ?
List<Integer> removed = new AbstractList<Integer>() {
final BitSet clone = (BitSet) selectedIndices.clone();
@Override public Integer get(int index) {
return clone.nextSetBit(index);
}
@Override public int size() {
return clone.cardinality();
}
};
Suppose indices 2 and 3 were selected before the call.
The removed list as implemented above will look like [2, 2] instead of [2, 3] which should be obvious from the code.
Why not use createListFromBitSet(...) as in clearAndSelect() ?