Simple Cons List implementation in Java