I try with a loop like that
// ArrayList tourists for (Tourist t : tourists) { if (t != null) { t.setId(idForm); } }
Similar to @Lithium answer but does not throw a "List may not contain type null" error:
list.removeAll(Collections.singleton(null));