4 ms·
The type system isn't fine. Try making an ArrayList<int> or a Integer[]. Also, due to type erasure, it is impossible to check the type of a generic at runtime w
by adgjlsfhk1 5y ago
The type system isn't fine. Try making an ArrayList<int> or a Integer[]. Also, due to type erasure, it is impossible to check the type of a generic at runtime which can be really annoying.
- kaba0 5y ago> Try making an ArrayList<int> or a Integer[] Yes and that is due to boxing/unboxing. This is also being worked on. And while you indeed can’t check the generic type of a generic object, I really rarely see any reason for that. Like, if you have written code in any language without reflection, you can’t do that for any object and it is not a hindrance in itself.