I just started with java and I have methods that support changes and that store pre and post change values and I have to be able to undo them. And sorry for the extra text, just want to be clear as much as I can be. I can't figure out how to store the pre and post change values and to let them be "undoable". Would appreciate any ideas on how to approach this.
public void setName(String name)
Sets the name of the product. The passed name can be null or an empty string. If the passed name is null the name is initialized with an empty string. Before the name change, the current state is stored so this action can be reverted.
public boolean undo()
Undoes the last change. Returns true if the current state of this object is changed by this operation. If no change can be undone, false is returned.