<p>I write a Text Editor with Java , and  I want to  add Undo function to it </p>

<p>but without UndoManager Class , I need to use a Data Structure like Stack or LinkedList but the Stack class in Java use Object parameters e.g : push(Object o) , Not Push(String s)
I need some hints or links .
Thanks</p>

Assuming you are using Java 5, Stack is a generic class. You can instantiate it according to the objects it should hold.
You can then use:
```
```
Stack<String> stack = new Stack<String>();
String string = "someString";
stack.push(string);
```
```
Also note that in the case you are using Java 1.4 or below, you can still push String objects into the stack. Only that you will need to explicitly downcast them when you pop() them out, like so:
```
```
Stack stack = new Stack();
String string = "someString";
stack.push(string);

String popString = (String) stack.pop(); // pop() returns an Object which needs to be downcasted
```
```