I have a piece of code where I am trying to manipulate the contents of an array
loopArrayValuesToRemove(mVal.getValues());
Here I am trying to remove the contents of the array of values
private Values[] loopArrayValuesToRemove(Values[] values) {
List<Values> files = new ArrayList<>(Arrays.asList(values.clone()));
Iterator<Values> iterator = files.iterator();
while(iterator.hasNext()) {
Values mVal = iterator.next();
if(!mVal.isCheckedLocally()){
iterator.remove();
}
// other operations
}
Values[] mvals = files.toArray(new Values[files.size()]);
return mvals;
}
- Since I am creating the new object even if I manipulate
Values[]
,mVal.getValues()
contents are not modified. - It's a Silly question, but I am stuck at this. as I cannot change the
response to arrayList in server at (
mVal.getValues()
)