I have a list of beans (List<AClass>
), from which I am creating two sub list based some logic which involves checking a field from the bean class, say action. if
bean.getAction.equals("true") - add to new sublist - List<AClass> listA
else - add to new sublist - List<AClass> listB
I have created a method for it and it works fine.
Now I have similar task for other Bean class as well where i have List<BClass>
which also has action field and getAction method. I want to create a generic method which would cater to both these beans (and other similar beans as well).
How can I create such method?
Use List<? extends ParentClass>
where ParentClass
is parent of AClass
and BClass
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments