Question

I am using Java1.7 and using generics.

I wrote a generic class as below.

 public class SomeCollection<T extends MyPojo<K>, K> {



    }

Now, how can i instantiate above class? I mean how can i create an instance for above class?

I am doing as: SomeCollection<MyPojoSubClass, SomeType> sss = new SomeCollection<>(); Compiler is not giving any error. IS it correct way ?

Thanks!

Était-ce utile?

La solution

new SomeCollection<MyPojo<String>, String>(); 

Or are we missing something?

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top