static TFloatLinkedList link(float[] values, int valOffset, int len) { TFloatLinkedList ret = new TFloatLinkedList(); for (int i = 0; i < len; i++) { ret.add(values[valOffset + i]); } return ret; }
/** {@inheritDoc} */ public TFloatList subList(int begin, int end) { if (end < begin) { throw new IllegalArgumentException("begin index " + begin + " greater than end index " + end); } if (size < begin) { throw new IllegalArgumentException( "begin index " + begin + " greater than last index " + size); } if (begin < 0) { throw new IndexOutOfBoundsException("begin index can not be < 0"); } if (end > size) { throw new IndexOutOfBoundsException("end index < " + size); } TFloatLinkedList ret = new TFloatLinkedList(); TFloatLink tmp = getLinkAt(begin); for (int i = begin; i < end; i++) { ret.add(tmp.getValue()); // copy tmp = tmp.getNext(); } return ret; }
/** {@inheritDoc} */ public void insert(int offset, float value) { TFloatLinkedList tmp = new TFloatLinkedList(); tmp.add(value); insert(offset, tmp); }