Université en TypeScript

Translate this TypeScript program into Java

Download TypeScript program Universite.ts.zip 

class Universite<E extends Etudiant> {
    private readonly _etudiants: Set<E> = new Set();

    private _add(e: E): void {
        for (const e_ of this._etudiants) {
            // if (e_ instanceof Etudiant_etranger &&
            //     e instanceof Etudiant_etranger && e_.id_pays_origine === e.id_pays_origine) return; // Q6
            if (e_.n_INSEE === e.n_INSEE) return;
            // if (e_.n_etudiant === e.n_etudiant) return; // Q5
        }
        this._etudiants.add(e);
    }

    public constructor(...etudiants: Array<E>) {
        for (const e of etudiants) {
            this._add(e);
        }
        // console.log(this._etudiants.size); // Test...
    }
}


class Personne {
    /* ... */
}

class Etudiant extends Personne {
    public constructor(private readonly _n_etudiant: string, private readonly _n_INSEE: string) {
         // Q1
    }

    get n_etudiant(): string {
        return this._n_etudiant;
    }

    get n_INSEE(): string {
        return this._n_INSEE;
    }

    public static Main(): void {
        const XX: Etudiant = new Etudiant("1", "2000164444555");
        const XY: Etudiant = new Etudiant("2", "1010264222333");
        const XZ: Etudiant = new Etudiant_etranger("3", "", "CODE PAYS ORIGINE");
        const XW: Etudiant_etranger = new Etudiant_etranger("4", "", "AUTRE CODE PAYS ORIGINE");
        const mon_universite: Universite<Etudiant> = new Universite(XX, XY, XZ, XW);
    }
}

class Etudiant_etranger extends Etudiant {
    // Identifiant propre au pays car n°INSEE n'existe probablement pas :
    constructor(n_etudiant: string, n_INSEE: string, private readonly _id_pays_origine: string) {
         // Q2
    }

    get id_pays_origine(): string {
        return this._id_pays_origine;
    }
}

Etudiant.Main();