I have a list that used for adapter for ListView in Android.
Most time, the List is used for read but sometimes replace of all List contents is needed.
which type of code below (replaceListA, replaceListB) is preferred? or another way to replace the list?
thank you in advance.
private ArrayList<Model> list = new ArrayList<Model>();
public synchronized void replaceListA(List newList) {
list.clear();
list.addAll(newList);
}
public synchronized void replaceListB(List newList) {
list = newList;
}