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

Popular posts from this blog

c - Compilation of a code: unkown type name string -

java - Bypassing "final local variable defined in an enclosing type" -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -