This completely depends on whether underlying list is thread safe on read operations. Unmodifiable list just passes all read calls, such as size ()
, get (int)
etc to underlying list without additional synchronization.
Imagine, for example, implementation of List which caches hash code instead of calculating it each time it is needed. For such implementation, hashCode ()
method is actually not read-only, because it may modify internally cached hash code value.
Another example is a flavor of LinkedList which caches reference to last accessed entry together with its index, so further attempts to access nearby elements will be performed much faster. For such implementation, method get (int)
will be not read-only because it updates cached reference and index, and thus will probably be not thread safe.