Please note: even though I mention Dozer in this question, I do believe its really just a pure Java generics question at heart. There may be a Dozer-s ...
Please note: even though I mention Dozer in this question, I do believe its really just a pure Java generics question at heart. There may be a Dozer-s ...
So I have some classes like BooleanLogger, IntLogger etc., which implement my own Logger interface. This is the Logger interface: public interface L ...
I am confused about subtypes in Scala. My major question is how to distinguish C[T1] from C[T2]. There are two scenarios: C[T1] "equals" C[T2] bec ...
At first glance I thought the following makes sense: And it compiles properly so everything seems A-OK. But then I thought about it some more, in ...
I intend to write a generic method to convert a json list into it's specific list with class. This is the generic json parser: Here is a dummy clas ...
Can someone explain why the following code does not compile: ArrayList<List<?>> arrayList = new ArrayList<List<String>>(); W ...
I have a homemade storage object that is similar to Set interface methods. I want to make it compatible with Set so it can be compatible with Collecti ...
I'm trying to run a code. i and i get two compilation errors: 1.Reference to System.out.println is ambiguous (conflict between method that gets char[] ...
I have a method which is often called with an argument of generic type, and I want it to behave differently depending on the specific subclass of the ...
In my code below, I have a function test that takes in a object of type magnet and I have two implicit methods converting List[Int] to magnet and the ...
The code following is taken from Oracle documentation of generics - My understanding of this code - Q - is method setData overrided or overloade ...
I'm trying to use type erasure in order to access the inherited methods of the general type. I have a parent class, Space, and child classes, Scalar, ...
I figured out how to use a TypeTag to add a empty parameter list to an existing method and bypass the erasure error. I'd like to understand how my hac ...
I'm creating a class-wide project with my school mates, I'm supposed to create pull requests for some functions, but I'm having some problems just cre ...
I have the following SSCCE: This seems fine to me, but the compiler complains that: I have no idea what this even means, much less how to correc ...
When coding in Kotlin/Java, I stumbled onto something rather odd while using casting and generics. It seems to be possible to have the type system bel ...
So say we have a few classes like this: This works The code has a bunch of repetition, however. Since the only thing that varies is the type th ...
In Java, generic types are erased at compilation and instead Object is substituted for all generic parameters and an implicit cast is done. The reason ...
The following code does not compile, however, if I change f(object) to f(String) or f(Integer) it compiles. I've read the other posts about the subjec ...
How can it be the case that ArrayList<Class<?>> has the same erasure of ArrayList<Object> but cannot be cast to it? My code is curr ...