/** * Get the first element that's not a duplicate of the element at the specified * index. This is useful for things like {@link #getCount(int)} because we can * find the full range of a value quickly. */ private int getEndIndex(int index) { if(index == (size() - 1)) return source.size(); else return getSourceIndex(index + 1); }
/** * Get the first element that's not a duplicate of the element at the specified * index. This is useful for things like {@link #getCount(int)} because we can * find the full range of a value quickly. */ private int getEndIndex(int index) { if(index == (size() - 1)) return source.size(); else return getSourceIndex(index + 1); }
/** * Get the first element that's not a duplicate of the element at the specified * index. This is useful for things like {@link #getCount(int)} because we can * find the full range of a value quickly. */ private int getEndIndex(int index) { if(index == (size() - 1)) return source.size(); else return getSourceIndex(index + 1); }
/** {@inheritDoc} */ @Override public E remove(int index) { if(index < 0 || index >= size()) throw new IndexOutOfBoundsException("Cannot remove at " + index + " on list of size " + size()); updates.beginEvent(true); // remember the first duplicate E result = get(index); // remove all duplicates at this index int startIndex = getSourceIndex(index); int endIndex = getEndIndex(index); ((SortedList)source).subList(startIndex, endIndex).clear(); updates.commitEvent(); return result; }
/** {@inheritDoc} */ @Override public E remove(int index) { if(index < 0 || index >= size()) throw new IndexOutOfBoundsException("Cannot remove at " + index + " on list of size " + size()); updates.beginEvent(true); // remember the first duplicate E result = get(index); // remove all duplicates at this index int startIndex = getSourceIndex(index); int endIndex = getEndIndex(index); ((SortedList)source).subList(startIndex, endIndex).clear(); updates.commitEvent(); return result; }
/** {@inheritDoc} */ @Override public E remove(int index) { if(index < 0 || index >= size()) throw new IndexOutOfBoundsException("Cannot remove at " + index + " on list of size " + size()); updates.beginEvent(true); // remember the first duplicate E result = get(index); // remove all duplicates at this index int startIndex = getSourceIndex(index); int endIndex = getEndIndex(index); ((SortedList)source).subList(startIndex, endIndex).clear(); updates.commitEvent(); return result; }
/** {@inheritDoc} */ @Override protected int getSourceIndex(int index) { if(index == size()) return source.size(); return grouper.getBarcode().getIndex(index, Grouper.UNIQUE); }
/** {@inheritDoc} */ @Override public E set(int index, E value) { if(index < 0 || index >= size()) throw new IndexOutOfBoundsException("Cannot set at " + index + " on list of size " + size()); updates.beginEvent(true); // remove all duplicates of this value first int startIndex = getSourceIndex(index) + 1; int endIndex = getEndIndex(index); if(endIndex > startIndex) { ((SortedList)source).subList(startIndex, endIndex).clear(); } // now do the set E result = super.set(index, value); updates.commitEvent(); return result; }
/** {@inheritDoc} */ @Override public E set(int index, E value) { if(index < 0 || index >= size()) throw new IndexOutOfBoundsException("Cannot set at " + index + " on list of size " + size()); updates.beginEvent(true); // remove all duplicates of this value first int startIndex = getSourceIndex(index) + 1; int endIndex = getEndIndex(index); if(endIndex > startIndex) { ((SortedList)source).subList(startIndex, endIndex).clear(); } // now do the set E result = super.set(index, value); updates.commitEvent(); return result; }
/** {@inheritDoc} */ @Override public E set(int index, E value) { if(index < 0 || index >= size()) throw new IndexOutOfBoundsException("Cannot set at " + index + " on list of size " + size()); updates.beginEvent(true); // remove all duplicates of this value first int startIndex = getSourceIndex(index) + 1; int endIndex = getEndIndex(index); if(endIndex > startIndex) { ((SortedList)source).subList(startIndex, endIndex).clear(); } // now do the set E result = super.set(index, value); updates.commitEvent(); return result; }
/** {@inheritDoc} */ @Override protected int getSourceIndex(int index) { if(index == size()) return source.size(); return grouper.getBarcode().getIndex(index, Grouper.UNIQUE); }
/** {@inheritDoc} */ @Override protected int getSourceIndex(int index) { if(index == size()) return source.size(); return grouper.getBarcode().getIndex(index, Grouper.UNIQUE); }