CSC300: Generic classes [4/6] Previous pageContentsNext page

A generic class has a type parameter. Type is not stored at runtime.

file:Stack.java [source]
01
02
03
04
05
06
07
08
09
10
package ds1.student.stack;

/// An interface defining the Stack ADT.
/// DO NOT CHANGE THIS INTERFACE.
public interface Stack<T> extends Iterable<T> {
    void push(T t);
    T pop();
    boolean isEmpty();
    int size();
}

Previous pageContentsNext page