4 ms·
Fun fact - if you don’t like Java erasing types by default, you can just pass them along manually yourself. There’s a bunch of ways to do this, but I’ll just l
by zeroimpl 6y ago
Fun fact - if you don’t like Java erasing types by default, you can just pass them along manually yourself.
There’s a bunch of ways to do this, but I’ll just leave this one trick here.
Instead of:
List<Integer> x = new ArrayList<Integer>();
write this:
List<Integer> x = new ArrayList<Integer>(){};
Now you’ll be able to ask at runtime and determine it is a subclass of List<Integer>.