I'm trying to change the value on an ArrayList<String>
called this way
mails.forEach(mail -> {
mail = "my_new_value";
System.out.println(mail);//here the value is correct
});
But outside the loop mails has the original value,I thought that on Java every thing is passed by a reference,what is the problem?