import java.io.*;

public class LinkedList {
    private Node first;

    LinkedList() {
        first = null;
    }

    void addFront (int item) {
        first = new Node(item, first);
    }

    boolean empty() {
        return (first == null);
    }

    Node car() {
        return first;
    }

    LinkedList cdr() {
        LinkedList l = new LinkedList();
        l.first = first.next;
        return l;
    }
}

class Node {
    public int item;
    public Node next;

    Node(int item, Node next) {
        this.item = item;
        this.next = next;
    }
}


The views and opinions expressed in this page are strictly those of the page author. The contents of this page have not been reviewed or approved by the University of Minnesota.