Verificador de "Numero digitado"

Scanner teclado = new Scanner(System.in);
    java.util.List<String> name = new ArrayList<>();
    java.util.List<Integer> id = new ArrayList<>();
    java.util.List<Double> salary = new ArrayList<>();
    java.util.List<Boolean> truefalse = new ArrayList<>();

    System.out.print("How many employees will be registered? : ");
    int N = teclado.nextInt();
    int[] ene = new int[N];

    String n;
    int i;
    double s;
    Entities[] func = new Entities[N];
    for (int x = 0; x < N; x++) {

        System.out.println("Emplyoee #" + (x + 1) + ":");
        System.out.print("ID : ");
        i = teclado.nextInt();
        System.out.print("Name : ");
        teclado.nextLine();
        n = teclado.nextLine();
        System.out.print("Salary : ");
        s = teclado.nextDouble();
        name.add(x, n);
        id.add(x, i);
        salary.add(x, s);
        func[x] = new Entities(id.get(x), name.get(x), salary.get(x));
        
        
        truefalse.add(i,Boolean.TRUE);
        if (truefalse.get(x) == false) {
            System.out.println("the id is free");
        } else {
            while (truefalse.get(x) == true) {
                System.out.println("ID is utilized");
                System.out.println("Type again other ID's number");
                i = teclado.nextInt();
            }
        }
        
    }
    for (int j = 0; j < N; j++) {
        System.out.println(func[j].toString());
    }
}

}

Eu queria uma função para que o boolean na posição do número da ID digitada se tornasse True,para assim eu verificar se a ID já foi utilizada,e se foi pedir para re-digitar até sair do loop