Extending a Java collection class like ArrayList for easier Generics management (warnings...etc)? -
extending java default collections not considered practice. wondering if, sake of cleaner code, 1 not extend, arraylist rid of generic. example
public class doodlelist extends arraylist<doodle> { /** * */ private static final long serialversionuid = 1l; }
so in one's code thing "someframework.getcontentas(doodlelist.class)" without having nasty warnings generics...etc
note wrapping list might not option in case : class used in json mapping desired output :
{doodles : [doodle1,doodle2,doodle3]}
not {doodles : {innercollection : [doodle1,doodle2,doodle3]}}
hiding nasty warnings playing around inheritance smells me.
why not use annotation suppress warning. example:
@suppresswarnings("unchecked") someframework.getcontentas(arraylist.class)"