As you all know, the Memento pattern is the default that saves different states of objects and then retrieves them.
The intent is not to retrieve the "last" entry and then remove it? This is a stack, right?
So why do examples use
ArrayList by taking the index element (quantity - 1) and does not use
Do you have an explanation for this?
I'm using C #, but I can understand java, so this question is for both.
In C # I'm using
List and to recover I'm using
TextoMemento estadoSalvo = estados.ElementAt(estados.Count -1); estados.RemoveAt(estados.Count - 1);