My function is update the ArrayList, but doesn't update the boolean, it's very weird!
I just not understand, or them both updates, or them both not.
private ArrayList<String> arrayList = new ArrayList<>();
private boolean isEmpty = true;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
addNames(arrayList, isEmpty);
Log.d("status", arrayList.size() + " " + isEmpty);
}
private void addNames(ArrayList<String> names, boolean empty) {
names.add("Moshe");
names.add("Noa");
names.add("Haim");
empty = false;
}
How can i update the isEmpty variable? (this.isEmpty = false; is not good for me, i need another way)