I have to implement a stack in the form of Linked List for one of my assignments. We have to implement the interface `DStack`, which has the methods `push()`, `pop()`, `peek()`, and `isEmpty()` in our `LinkedList.java` file. The list would take a series of doubles as its content.

What I am still struggling with is basically the `push()` and `pop()` methods for linked lists. I am not sure about the nodes I have made, but here is the code that I have so far:

```
public class ListStack implements DStack{

private Node head;
private int size;

private class Node{
    double d;
    Node next;

    public Node(){
        head = null;
        next = null;
    }

    public Node(double data){
        d = data;
    }
}

public boolean isEmpty() {
    return (head == null);
}

@Override
public void push(double d) {
    if(!isEmpty()){
        Node newHead = new Node(d);
        newHead.next = head;
        head = newHead;
        size++;
    }
    else
        throw new EmptyStackException(); //To change body of generated methods, choose Tools | Templates.
}

@Override
public double pop() {
    if(!isEmpty()){
        double d = head.d;
        head = head.next;
        size--;
        return d;
    }
    else
        throw new EmptyStackException(); //To change body of generated methods, choose Tools | Templates.
}

@Override
public double peek() {
    if(!isEmpty()){
        return head.d;
    }
    else
        throw new EmptyStackException(); //To change body of generated methods, choose Tools | Templates.
}

```

Could someone advise me if I am doing the `push()` and `pop()` methods correctly? If not, where exactly do I need to revise it? I'm looking for explanations online but most of the materials don't really make sense to me.

Also, my teacher forbid us to use any other classes from the Java framework or other class library. Does this mean I cannot use `Iterable` in my code? If so, then creating the additional methods for linked lists such as `remove()`, `next()`, etc. are not needed, right?

I'm still tripping over these linked lists concepts so if anyone could clear this up, I would really appreciate it. Thank you!