163 * @param index index of the element to return
164 * @return the element at the specified position in this list
165 * @throws IndexOutOfBoundsException {@inheritDoc}
166 */
167 @Override
168 public E get(int index) {
169 if (index >= size) {
170 throw new IndexOutOfBoundsException();
171 }
172 return getSource().get(filtered[index]);
173 }
174
175 @Override
176 public int getSourceIndex(int index) {
177 if (index >= size) {
178 throw new IndexOutOfBoundsException();
179 }
180 return filtered[index];
181 }
182
183 private SortHelper getSortHelper() {
184 if (helper == null) {
185 helper = new SortHelper();
186 }
187 return helper;
188 }
189
190 private int findPosition(int p) {
191 if (filtered.length == 0) {
192 return 0;
193 }
194 if (p == 0) {
195 return 0;
196 }
197 int pos = Arrays.binarySearch(filtered, 0, size, p);
198 if (pos < 0 ) {
199 pos = ~pos;
200 }
201 return pos;
202 }
|
163 * @param index index of the element to return
164 * @return the element at the specified position in this list
165 * @throws IndexOutOfBoundsException {@inheritDoc}
166 */
167 @Override
168 public E get(int index) {
169 if (index >= size) {
170 throw new IndexOutOfBoundsException();
171 }
172 return getSource().get(filtered[index]);
173 }
174
175 @Override
176 public int getSourceIndex(int index) {
177 if (index >= size) {
178 throw new IndexOutOfBoundsException();
179 }
180 return filtered[index];
181 }
182
183 @Override
184 public int getViewIndex(int index) {
185 return Arrays.binarySearch(filtered, 0, size, index);
186 }
187
188 private SortHelper getSortHelper() {
189 if (helper == null) {
190 helper = new SortHelper();
191 }
192 return helper;
193 }
194
195 private int findPosition(int p) {
196 if (filtered.length == 0) {
197 return 0;
198 }
199 if (p == 0) {
200 return 0;
201 }
202 int pos = Arrays.binarySearch(filtered, 0, size, p);
203 if (pos < 0 ) {
204 pos = ~pos;
205 }
206 return pos;
207 }
|