Frage

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!

War es hilfreich?

Lösung

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

Or are we missing something?

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top