If we declare an object with Collection reference type and call replacAll() on this object- Collection al = new ArrayList<>(); al.replaceAll(param);
Collection al = new ArrayList<>();
al.replaceAll(param);