It's been a while since I touched generics in Java, I have this:
Map<List<MyGenericType>, Set<List<MyGenericType>>> x = new HashMap<>();
In truth, MyGenericType
requires a generic parameter, since it is defined like this:
public class MyGenericType<X> {}
I declared x
with pre-emptive type-erasure of MyGenericType
because I didn't want to make an empty marker interface just for the sake of grouping things. Will this, for the sake of having a collection, work in my favor or will I have to make a marker interface to make this possible?
(EDIT) That is:
public interface SomeCommonInterface {...}
MyGenericType implements SomeCommonInterface ...
Map<List<SomeCommonInterface>, Set<List<SomeCommonInterface>>> x = new HashMap<>();
>, Set
– Eugene Jul 11 '20 at 20:47>>> x = new HashMap<>(); x.put(List.of(new MyGenericType()), Set.of(List.of(new MyGenericType())));`. there are _two_ unbounded types in the declaration, these are different types for the compiler