Java generics - getting the type..

Posted by peter on Stack Overflow See other posts from Stack Overflow or by peter
Published on 2010-05-09T13:57:10Z Indexed on 2010/05/09 14:08 UTC
Read the original article Hit count: 176

Filed under:
|

Hi! I'm a c# guy giving Java a try .. so how would I do the following in java.

in C#

public T create_an_instance_of<T>(){
  T instance = default (T);
 // here's usually some factory to create the implementation
   instance =  some_factory.build<T>();
 // or even..
   instance = some_factory.build(typeOf(T) );

 return instance;
}

© Stack Overflow or respective owner

Related posts about java

Related posts about generics