So I want to use some thread, after all we're multithreading. The code in the main's try{} block sometimes run properly, but sometimes the main's thread faster than myThread, and don't add the last element to allPeople list (i tried several times in the test block). Is there any solution to wait all the threads, where I know it's necessary, when the Threads called indirectly, like in my code? EDIT I fixed the method:
private void minusC(String name,String sex,String bd){
            try {
                Person p = formatSex(sex) == Sex.MALE ? Person.createMale(name,formatDate(bd)) : Person.createFemale(name,formatDate(bd));
                allPeople.add(p);
                System.out.println(allPeople.indexOf(p));
            } catch (Exception e){
                System.out.println("Cannot crate Person()");
                System.out.println(e.getClass().getSimpleName());
            }
        }