/** {@inheritDoc} */ @Override public short[] toArray(short[] dest, int source_pos, int dest_pos, int len) { if (len == 0) { return dest; // nothing to copy } if (source_pos < 0 || source_pos >= _pos) { throw new ArrayIndexOutOfBoundsException(source_pos); } _data.toArray(source_pos, dest, dest_pos, len); return dest; }
/** {@inheritDoc} */ @Override public TShortList subList(int begin, int end) { if (end < begin) { throw new IllegalArgumentException("end index " + end + " greater than begin index " + begin); } if (begin < 0) { throw new IndexOutOfBoundsException("begin index can not be < 0"); } if (end > capacity()) { throw new IndexOutOfBoundsException("end index < " + capacity()); } TShortArrayList list = new TShortArrayList(end - begin); _data.toArray(begin, list._data, 0, end - begin); list._pos = end - begin; return list; }