I would like to put non-modifiable wrappers around some Trove collections: I checked the Trove documentation and I cannot find an easy way to do this (maybe I missed something obvious).
So, every time I need such an unmodifiable shell, I expand the Trove collection (for example, TIntLongHashMap) and delegate all read-only calls to the object wrapped in Trove, and throw an UnsupportedOperation exception in every method that tries to change the collection.
Is there an easier way?
Note. . This question does not apply to standard Java collections, and in this case, I am not interested in either the default Java builds or other Java collections: this question is specifically about Trove.
source
share