what is type erasure? why does Java use it when dealing with templated generic classes? what does java do instead
Type erasure is a pattern applied to protocols with associated types. With its help we can work around the strong type safety of the Swift compiler in order to use the protocols in a way that is similar to using protocols without associated types.
Why does Java use it?
The Java compiler applies type erasure to implement generics and to:
Type erasure ensures that no new classes are created for parameterized types.
PLEASE GIVE A THUMBS UP IF IT WAS HELPFUL AND LEAVE A COMMENT FOR ANY QUERY.
THANKS.
Get Answers For Free
Most questions answered within 1 hours.