/** * Constructs a new instance that is a copy of the old instance. * * @param old instance to copy */ public LabeledList(LabeledList old) { super(old.size()); labelToIndex = old.labelToIndex.mutableCopy(); int sz = old.size(); for (int i = 0; i < sz; i++) { Object one = old.get0(i); if (one != null) { set0(i, one); } } }
/** * Constructs a new instance that is a copy of the old instance. * * @param old instance to copy */ protected LabeledList(LabeledList old) { super(old.size()); labelToIndex = old.labelToIndex.mutableCopy(); int sz = old.size(); for (int i = 0; i < sz; i++) { Object one = old.get0(i); if (one != null) { set0(i, one); } } }
/** * Constructs a new instance that is a copy of the old instance. * * @param old instance to copy */ public LabeledList(LabeledList old) { super(old.size()); labelToIndex = old.labelToIndex.mutableCopy(); int sz = old.size(); for (int i = 0; i < sz; i++) { Object one = old.get0(i); if (one != null) { set0(i, one); } } }
/** * Constructs a new instance that is a copy of the old instance. * * @param old instance to copy */ public LabeledList(LabeledList old) { super(old.size()); labelToIndex = old.labelToIndex.mutableCopy(); int sz = old.size(); for (int i = 0; i < sz; i++) { Object one = old.get0(i); if (one != null) { set0(i, one); } } }
/** * Constructs a new instance that is a copy of the old instance. * * @param old instance to copy */ public LabeledList(LabeledList old) { super(old.size()); labelToIndex = old.labelToIndex.mutableCopy(); int sz = old.size(); for (int i = 0; i < sz; i++) { Object one = old.get0(i); if (one != null) { set0(i, one); } } }
/** * Constructs a new instance that is a copy of the old instance. * * @param old instance to copy */ public LabeledList(LabeledList old) { super(old.size()); labelToIndex = old.labelToIndex.mutableCopy(); int sz = old.size(); for (int i = 0; i < sz; i++) { Object one = old.get0(i); if (one != null) { set0(i, one); } } }
/** * Constructs a new instance that is a copy of the old instance. * * @param old instance to copy */ public LabeledList(LabeledList old) { super(old.size()); labelToIndex = old.labelToIndex.mutableCopy(); int sz = old.size(); for (int i = 0; i < sz; i++) { Object one = old.get0(i); if (one != null) { set0(i, one); } } }
/** * Constructs a new instance that is a copy of the old instance. * * @param old instance to copy */ public LabeledList(LabeledList old) { super(old.size()); labelToIndex = old.labelToIndex.mutableCopy(); int sz = old.size(); for (int i = 0; i < sz; i++) { Object one = old.get0(i); if (one != null) { set0(i, one); } } }
/** * 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; }
/** * 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 {@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); } } }