0

Let's get to the point. I'm using a LinkedList to store some info about the objects it store. The thing is, I can't set all the attributes of the objects right when I create it, so I need to access them later. In fact, this is the piece of code where I access it.

listaNodos.get(esteNodo(nodoActual)).caminoVuelta.getLast().setFin(currentGrid); listaNodos.get(esteNodo(nodoActual)).caminoVuelta.getLast().setPath(caminoVuelta);

Just as a clarification: caminoVuelta is also a LinkedList. So, can I modify the atributes of the instances stored in caminoVuelta by simply accessing them with getLast() method from LinkedList and then using the set() methods? Or will this change never happen to the original object?

For some reason, (and it only happens for the first node(Nodo) I create) it returns a NullPointerException.

I hope it's clear enough. Thanks.

0 Answers0