http://stackoverflow.com/questions/18581002/how-to-create-a-generic-array /** * array of generic elements to represent the stack */ private T[] stack; /** * Creates an empty stack using the specified capacity. * @param initialCapacity represents the specified capacity */ public ArrayStack (int initialCapacity) { top = 0; stack = (T[])(new Object[initialCapacity]); }
The reason for doing the work is to create something useful that helps people. Please click the ads if my articles are useful for you. Definitely, that's not enough. My target is working at some great organizations, such that one day, all the people with internet access can benefit from the service I contributed.