Java – list iteration – General Logic
•
Java
I have a bean list (list < aclass >), from which I create two sub lists based on some logic, including checking the fields in the bean class, such as action If
bean.getAction.equals("true") - add to new sublist - List<AClass> listA else - add to new sublist - List<AClass> listB
I've created a method for it, and it works properly
Now I have similar tasks for other bean classes. I have list < bclass > with action field and getaction method I want to create a common method to satisfy these two beans (and other similar beans)
How can I create such a method?
Solution
Use list where parentclass is the parent of aclass and bcass
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码