Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

They mean const in the sense of readonly guarantees.

In java types are generally shared and mutable so let's say you want a list input, you generally don't store it as is because the caller could modify it at any point, so if you accept a `List`, you defensively copy it into an inner type for safety, which has a cost (even more so if you also need to defensively copy the list contents).

And likewise on output otherwise the caller could downcast and modify (in that specific case you could wrap it in an unmodifiableList, but not all types have an unmodifiable view available).



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

Search: