Compare two linked lists

Problem: For two linked list containing characters, check if both are equal or not.

Problem Explanation: For a given linked lists

Input: list1 = t->e->s->t
       list2 = t->e->s->t
Output: 0
Input: list1 = t->e->s->t -> a
       list2 = t->e->s->t
Output: 1

Java Implementation
public class CompareLL {
    public int compareStringLL(Node first, Node second) {
        while (first != null && second != null && first.getValue() == second.getValue()) {
            first = first.getLink();
            second = second.getLink();
        }

        if (first != null && second != null) {
            if (first.getValue() > second.getValue())
                return 1;

            else
                return -1;
        }

        if (first != null && second == null) {
            return 1;
        }

        if (first == null && second != null) {
            return -1;
        }
        return 0;
    }

    public static void main(String[] args) {
        CompareLL compareLL = new CompareLL();
        Node first = new Node('t', null);
        first.setLink(new Node('e', null));
        first.getLink().setLink(new Node('s', null));
        first.getLink().getLink().setLink(new Node('t', null));
        first.getLink().getLink().getLink().setLink(new Node('a', null));

        Node second = new Node('t', null);
        second.setLink(new Node('e', null));
        second.getLink().setLink(new Node('s', null));
        second.getLink().getLink().setLink(new Node('t', null));

        System.out.println(compareLL.compareStringLL(first, second));
    }
}

public class Node {
    private int value;
    private Node link;

    public Node(int value, Node n) {
        this.value = value;
        this.link = n;
    }

    public int getValue() {
        return value;
    }

    public void setValue(int value) {
        this.value = value;
    }

    public Node getLink() {
        return link;
    }

    public void setLink(Node link) {
        this.link = link;
    }
}

TimeComplexity: O(n)

Note: If you find any other better way to approach to this problem or you find any issue/error in above code snippets/approaches – please share it in the comments section below and get a chance to enrol free of cost for an online Live Data Structure and Algorithm course (specially designed for interview preparation for software companies like Amazon, Google, Facebook, FlipKart, SnapDeal, HealthKart…)