public class ListNode { private Object data; private ListNode next; public ListNode(Object data, ListNode next) { this.data = data; this.next = next; } public void setData(Object data) { this.data = data; } public Object getData() { return data; } public void setNext(ListNode next) { this.next = next; } public ListNode getNext() { return next; } public static int search(ListNode n, Object o) { ListNode temp; int i = 0; for ( temp = n; temp != null; temp = temp.getNext() ) { if (temp.getData().equals(o)) return i; i++; } } }