toArray(): T[] {
        let pntr = this.head;
        const array = [];
        while (pntr) {
            array.push(pntr.data);