Hacker News new | past | comments | ask | show | jobs | submit login

> 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.




I 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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: