Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I don't understand your comment - are you saying "ele" doesn't have enough info to find the next node?

You need an Iterator type that has the address of the previous and current nodes, in addition to your existing node / Element type.

    LinkedList<Element> list = new XORLinkedList(Collections.fromArray(arrayList));
    Iterator<Element> it = list.get(4); //now you can access it.element for data from index 4
    it.next(); // now access it.element for data from index 5


Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: