Original Post
I am trying to write a stack class because that is what we are discussing in class and I have a feeling I'll have to implement a function from the ADT, so I want to get a head start. Well, I have written a node class because I am going to implement the stack using a linked list rather than an array and it compiles fine. I wrote the constructor for my stack class and it works fine as well with the exception of a warning. The warning reads Note: C:\MyProjects\MyStack\MyStack.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. Here is my code. I think it might have something to do with my use of generics since I haven't had much practice using them, but if it isn't generics then I don't know what the problem could be as my linked list class works fine and it follows the same formula, more or less. Thanks.
public class MyStack <e>
{
private int size;
private sNode head;
private sNode tail;
MyStack()
{
size = 0;
// prev next elem
head = new sNode(null, null, null);
tail = new sNode(head, null, null);
head.setNext(tail);
}
}