Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

Why can I cast to a parametrized type?

Cast parametrized type
0
Posted

Why can I cast to a parametrized type?

0

GJ does not admit casting to a parametrized type. It cannot do this safely, since no run-time type information is maintained. But there are situations where a type conversion from Object to a parameterized type is essential, for instance when reading back serialized data. This task can be solved using GJ’s “raw types” feature. The primary purpose of raw types is to maintain backwards compatibility with current Java. But the feature can also be exploited to achieve casting, as follows: Say, you have a variable Vector

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123