While the parameterized type of locally declared collections is erased at compile time, it actually is possible to extract the type off of a field at runtime. Here's how it's done:
That's all there is to it. Note, this trick will not work if the collection declaration uses a wildcard or generic parameter.
No comments:
Post a Comment