DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Douglas has posted 12 posts at DZone. View Full User Profile

Java Cons Class

04.21.2008
| 4875 views |
  • submit to reddit
        Very simple Cons class for Java

public class Cons<T,U>
{
    private T car;
    private U cdr;

    public Cons( T carArg, U cdrArg )
    {
        car = carArg;
        cdr = cdrArg;
    }

    public T getCar(){ return car; }
    public U getCdr(){ return cdr; }
}