Java generic Interface performance

Posted by halfwarp on Stack Overflow See other posts from Stack Overflow or by halfwarp
Published on 2010-04-30T16:08:49Z Indexed on 2010/04/30 16:17 UTC
Read the original article Hit count: 137

Filed under:
|
|
|

Simple question, but tricky answer I guess.

Does using Generic Interfaces hurts performance?

Example:

public interface Stuff<T> {

    void hello(T var);
}

vs

public interface Stuff {

    void hello(Integer var);  <---- Integer used just as an example
}

My first thought is that it doesn't. Generics are just part of the language and the compiler will optimize it as though there were no generics (at least in this particular case of generic interfaces).

Is this correct?

© Stack Overflow or respective owner

Related posts about java

Related posts about generics