java - List iteration - Generic logic -
java - List iteration - Generic logic -
i have list of beans (list<aclass>
), creating 2 sub list based logic involves checking field bean class, action. if
bean.getaction.equals("true") - add together new sublist - list<aclass> lista else - add together new sublist - list<aclass> listb
i have created method , works fine.
now have similar task other bean class have list<bclass>
has action field , getaction method. want create generic method cater both these beans (and other similar beans well).
how can create such method?
use list<? extends parentclass>
parentclass
parent of aclass
, bclass
java generics
Comments
Post a Comment