/** * Gets an array containing all of the labels used in this instance, * in order. The returned array is freshly-allocated and so may be * modified safely by the caller without impacting this instance. * * @return {@code non-null;} ordered array of labels * @throws NullPointerException thrown if there are any {@code null} * items in this instance */ public final int[] getLabelsInOrder() { int sz = size(); int[] result = new int[sz]; for (int i = 0; i < sz; i++) { LabeledItem li = (LabeledItem) get0(i); if (li == null) { throw new NullPointerException("null at index " + i); } result[i] = li.getLabel(); } Arrays.sort(result); return result; }
/** * Gets an array containing all of the labels used in this instance, * in order. The returned array is freshly-allocated and so may be * modified safely by the caller without impacting this instance. * * @return {@code non-null;} ordered array of labels * @throws NullPointerException thrown if there are any {@code null} * items in this instance */ public final int[] getLabelsInOrder() { int sz = size(); int[] result = new int[sz]; for (int i = 0; i < sz; i++) { LabeledItem li = (LabeledItem) get0(i); if (li == null) { throw new NullPointerException("null at index " + i); } result[i] = li.getLabel(); } Arrays.sort(result); return result; }
/** * Gets an array containing all of the labels used in this instance, * in order. The returned array is freshly-allocated and so may be * modified safely by the caller without impacting this instance. * * @return {@code non-null;} ordered array of labels * @throws NullPointerException thrown if there are any {@code null} * items in this instance */ public final int[] getLabelsInOrder() { int sz = size(); int[] result = new int[sz]; for (int i = 0; i < sz; i++) { LabeledItem li = (LabeledItem) get0(i); if (li == null) { throw new NullPointerException("null at index " + i); } result[i] = li.getLabel(); } Arrays.sort(result); return result; }
/** * Gets an array containing all of the labels used in this instance, * in order. The returned array is freshly-allocated and so may be * modified safely by the caller without impacting this instance. * * @return {@code non-null;} ordered array of labels * @throws NullPointerException thrown if there are any {@code null} * items in this instance */ public final int[] getLabelsInOrder() { int sz = size(); int[] result = new int[sz]; for (int i = 0; i < sz; i++) { LabeledItem li = (LabeledItem) get0(i); if (li == null) { throw new NullPointerException("null at index " + i); } result[i] = li.getLabel(); } Arrays.sort(result); return result; }
/** * Sets the element at the given index. * * @param n {@code >= 0, < size();} which element * @param item {@code null-ok;} the value to store */ protected void set(int n, LabeledItem item) { LabeledItem old = (LabeledItem) getOrNull0(n); set0(n, item); if (old != null) { removeLabel(old.getLabel()); } if (item != null) { addLabelIndex(item.getLabel(), n); } } }
/** * Sets the element at the given index. * * @param n {@code >= 0, < size();} which element * @param item {@code null-ok;} the value to store */ protected void set(int n, LabeledItem item) { LabeledItem old = (LabeledItem) getOrNull0(n); set0(n, item); if (old != null) { removeLabel(old.getLabel()); } if (item != null) { addLabelIndex(item.getLabel(), n); } } }
/** * Sets the element at the given index. * * @param n {@code >= 0, < size();} which element * @param item {@code null-ok;} the value to store */ protected void set(int n, LabeledItem item) { LabeledItem old = (LabeledItem) getOrNull0(n); set0(n, item); if (old != null) { removeLabel(old.getLabel()); } if (item != null) { addLabelIndex(item.getLabel(), n); } } }
/** * Sets the element at the given index. * * @param n {@code >= 0, < size();} which element * @param item {@code null-ok;} the value to store */ protected void set(int n, LabeledItem item) { LabeledItem old = (LabeledItem) getOrNull0(n); set0(n, item); if (old != null) { removeLabel(old.getLabel()); } if (item != null) { addLabelIndex(item.getLabel(), n); } } }
/** * Sets the element at the given index. * * @param n {@code >= 0, < size();} which element * @param item {@code null-ok;} the value to store */ protected void set(int n, LabeledItem item) { LabeledItem old = (LabeledItem) getOrNull0(n); set0(n, item); if (old != null) { removeLabel(old.getLabel()); } if (item != null) { addLabelIndex(item.getLabel(), n); } } }
/** * Sets the element at the given index. * * @param n {@code >= 0, < size();} which element * @param item {@code null-ok;} the value to store */ protected void set(int n, LabeledItem item) { LabeledItem old = (LabeledItem) getOrNull0(n); set0(n, item); if (old != null) { removeLabel(old.getLabel()); } if (item != null) { addLabelIndex(item.getLabel(), n); } } }
/** * Sets the element at the given index. * * @param n {@code >= 0, < size();} which element * @param item {@code null-ok;} the value to store */ protected void set(int n, LabeledItem item) { LabeledItem old = (LabeledItem) getOrNull0(n); set0(n, item); if (old != null) { removeLabel(old.getLabel()); } if (item != null) { addLabelIndex(item.getLabel(), n); } } }
/** * Sets the element at the given index. * * @param n {@code >= 0, < size();} which element * @param item {@code null-ok;} the value to store */ protected void set(int n, LabeledItem item) { LabeledItem old = (LabeledItem) getOrNull0(n); set0(n, item); if (old != null) { removeLabel(old.getLabel()); } if (item != null) { addLabelIndex(item.getLabel(), n); } } }
/** * Rebuilds the label-to-index mapping after a {@code shrinkToFit()}. * Note: This assumes that the labels that are in the list are the * same, although the indicies may have changed. */ private void rebuildLabelToIndex() { int szItems = size(); for (int i = 0; i < szItems; i++) { LabeledItem li = (LabeledItem) get0(i); if (li != null) { labelToIndex.set(li.getLabel(), i); } } }
/** * Rebuilds the label-to-index mapping after a {@code shrinkToFit()}. * Note: This assumes that the labels that are in the list are the * same, although the indicies may have changed. */ private void rebuildLabelToIndex() { int szItems = size(); for (int i = 0; i < szItems; i++) { LabeledItem li = (LabeledItem) get0(i); if (li != null) { labelToIndex.set(li.getLabel(), i); } } }
/** * Rebuilds the label-to-index mapping after a {@code shrinkToFit()}. * Note: This assumes that the labels that are in the list are the * same, although the indicies may have changed. */ private void rebuildLabelToIndex() { int szItems = size(); for (int i = 0; i < szItems; i++) { LabeledItem li = (LabeledItem) get0(i); if (li != null) { labelToIndex.set(li.getLabel(), i); } } }
/** * Rebuilds the label-to-index mapping after a {@code shrinkToFit()}. * Note: This assumes that the labels that are in the list are the * same, although the indicies may have changed. */ private void rebuildLabelToIndex() { int szItems = size(); for (int i = 0; i < szItems; i++) { LabeledItem li = (LabeledItem) get0(i); if (li != null) { labelToIndex.set(li.getLabel(), i); } } }
/** * Rebuilds the label-to-index mapping after a shrinkToFit(). * Note: assumes that the labels that are in the list are the same * although the indicies may have changed. */ protected void rebuildLabelToIndex() { int szItems = size(); for (int i = 0; i < szItems; i++) { LabeledItem li = (LabeledItem)get0(i); if (li != null) { labelToIndex.set(li.getLabel(), i); } } }
/** * Rebuilds the label-to-index mapping after a {@code shrinkToFit()}. * Note: This assumes that the labels that are in the list are the * same, although the indicies may have changed. */ private void rebuildLabelToIndex() { int szItems = size(); for (int i = 0; i < szItems; i++) { LabeledItem li = (LabeledItem) get0(i); if (li != null) { labelToIndex.set(li.getLabel(), i); } } }
/** * Rebuilds the label-to-index mapping after a {@code shrinkToFit()}. * Note: This assumes that the labels that are in the list are the * same, although the indicies may have changed. */ private void rebuildLabelToIndex() { int szItems = size(); for (int i = 0; i < szItems; i++) { LabeledItem li = (LabeledItem) get0(i); if (li != null) { labelToIndex.set(li.getLabel(), i); } } }
/** * Rebuilds the label-to-index mapping after a {@code shrinkToFit()}. * Note: This assumes that the labels that are in the list are the * same, although the indicies may have changed. */ private void rebuildLabelToIndex() { int szItems = size(); for (int i = 0; i < szItems; i++) { LabeledItem li = (LabeledItem) get0(i); if (li != null) { labelToIndex.set(li.getLabel(), i); } } }