Returns a read-only view of set: membership, iteration and cursors go to the set, so the
owner's changes show through, and every method that would change it throws
UnsupportedOperationError. The view equals, and hashes like, the set.
When set is already a view this function returns (printed as UnmodifiableSet), it is returned
unchanged. When it is any other unmodifiable view or immutable collection from this copy of the
library, the new view reads that collection's source instead, and entries it hands out stay
read-only, so read-only wrappers never nest.
Time: O(1); each operation costs what the set's costs.
Returns a read-only view of
set: membership, iteration and cursors go to the set, so the owner's changes show through, and every method that would change it throwsUnsupportedOperationError. The view equals, and hashes like, the set.When
setis already a view this function returns (printed asUnmodifiableSet), it is returned unchanged. When it is any other unmodifiable view or immutable collection from this copy of the library, the new view reads that collection's source instead, and entries it hands out stay read-only, so read-only wrappers never nest.Time: O(1); each operation costs what the set's costs.