4 ms·
> Java libraries contain methods that return existential types (e.g. List<?>) everywhere. I don't know what libraries you are looking at but these are extremel
by incepted 11y ago
> Java libraries contain methods that return existential types (e.g. List<?>) everywhere.
I don't know what libraries you are looking at but these are extremely rare these days. At least for the popular ones. You seem to be talking about Java like it was written eight years ago.
- lmm 11y agoI gave List<?> as a simple example; usually we're talking about List<? extends Foo> or similar. Anything that involves a ? anywhere is an existential type, and they're the only way to write a whole lot of things safely, e.g. any kind of callback has to involve a "? super" type to avoid disallowing perfectly valid code. Unless the Java community has abandoned generics and decided to go back to using casts everywhere there's really no alternative in the language.