public Vector toVector() {
        Vector<E> vec = new Vector<E>(currentSize);
        for (int i = 0; i < currentSize; ++i) {
            if (array.getElement(i) != null) {
                vec.addElement(array.getElement(i));
            }
        }
        return vec;
    }