I am traversing a misunderstanding of List

xiaoxiao2021-03-06  83

I am traversing the list, when I change the Object in the List, I used to cycle the original list for loop, build a new list, and add Object to this new list every cycle. Finally return new list

as follows

Private list validateaction (list oblist) {

List newoblist = new arraylist ();

Ezoutboundform Obform = NULL;

For (int i = 0; i

Obform = (ezoutboundform) oblist.get (i);

IF (Obform.getStatus () == 5) {

Obform.setAction (3);

}

NEWOBLIST.ADD ();

}

Return newoblist;

}

Yesterday, I found that there is no need to do newlist, I can return to the original list after making changes.

Private list validateaction (list oblist) {

Ezoutboundform Obform = NULL;

For (int i = 0; i

Obform = (ezoutboundform) oblist.get (i);

IF (Obform.getStatus () == 5) {

Obform.setAction (3);

}

}

Return Oblist;

}

The VECTOR should be the same.

It seems that you still need to take a look at that this Think in Java, and review the review.

转载请注明原文地址:https://www.9cbs.com/read-107145.html

New Post(0)