// 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) 
package test;

import java.util.HashSet;

public class GenericsFun {
    public static void main(String[] args) {
        HashSet hs0 = new HashSet();
        hs0.add(0);
        hs0.add("0");
        HashSet<String> hs1 = new HashSet<String>();
        //hs1.add(1);
        hs1.add("1");
        MyHashSet2 hs2 = new MyHashSet2(); 
        hs2.add(2);
        hs2.add("2");
        MyHashSet3 hs3 = new MyHashSet3(); 
        //hs3.add(3);
        hs3.add("3");
        MyHashSet4<String> hs4 = new MyHashSet4<String>(); 
        //hs4.add(4);
        hs4.add("4");
    }
}

class MyHashSet2 extends HashSet {
    public MyHashSet2(){
        super();
    }
}

class MyHashSet3 extends HashSet<String> {
    public MyHashSet3(){
        super();
    }
}

class MyHashSet4<T> extends HashSet<T> {
    public MyHashSet4(){
        super();
    }
}
