generics - Why doesn't Java allow overloads based on type parameters? -


we can away in .net:

interface i<a> {} interface i<a, b> {} 

... in java, same code result in compilation error.

that's interesting, given if type information gone @ runtime, 1 expect information number of type parameter still there.

if limitation related type erasure, can explain why?

it's not related type erasure ambiguity arise using raw type:

i eye = null;  // 'i' it? 

raw types allowed in order accommodate code written before generics introduced in jdk 5.0.


Comments

Popular posts from this blog

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -