// Collection of code snippets by Arne Vajhøj 
// (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
import java.util.LinkedList;

public class LLCheck {
    private static LinkedList ll = null;

    public static void main(String[] args) {
        ll = new LinkedList();
        ll.add(new Something(1, "a"));
        ll.add(new Something(2, "bb"));
        ll.add(new Something(3, "ccc"));
        System.out.println(ll.indexOf(new Something(0, "")));
        System.out.println(ll.indexOf(new Something(1, "a")));
        System.out.println(ll.indexOf(new Something(2, "bb")));
        System.out.println(ll.indexOf(new Something(3, "ccc")));
        System.out.println(ll.indexOf(new Something(4, "dddd")));
    }
}

class Something {
    private int num = 0;
    private String str = null;
    public Something(int num, String str) {
        this.num = num;
        this.str = str;
    }
    public int getNum() {
        return num;
    }
    public String getStr() {
        return str;
    }
    public void setNum(int num) {
        this.num = num;
    }
    public void setStr(String str) {
        this.str = str;
    }
    public boolean equals(Object o) {
        if (o instanceof Something) {
            if (((Something)o).num == num &&
                ((Something)o).str.equals(str)) {
                return true;
            } else {
                return false;
            }
        } else {
            return false;
        }
    }
}
