アウトプットができる技術者に

it's a time to take a new step !

2013-10-18から1日間の記事一覧

new T() とか T.newInstance() とか って できない件

できないけど、回避方法があるんです。 なんと、コンストラクタで相称型TのObjectが受け取れます。 class Hoge<E> { Class<E> type; @SuppressWarnings("unchecked") public Hoge(E... e){ this.type = (Class<E>) e.getClass().getComponentType(); } public void ex</e></e></e>…