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

You can make immutable objects in Java. The result is quite, quite unpleasant IMHO, but so are many other things in Java. You just create an object that has final fields and a constructor (or a builder if you have a more complex object).

Now, nothing stops that immutable object containing a mutable object of course, but that's up to you ... Guava has immutable collections if you want them.

Better language support for immutability would not go amiss though.




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

Search: