Domanda

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!

È stato utile?

Soluzione

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

Or are we missing something?

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top