code: public static <T> List<T> unmodifiableList(List<? extends T> list) {
          return (list instanceof RandomAccess ?
                  new UnmodifiableRandomAccessList<>(list) :
                  new UnmodifiableList<>(list));
      }
docs: Returns an unmodifiable view of the specified list.  This method allows
  modules to provide users with "read-only" access to internal
  lists.  Query operations on the returned list "read through" to the
  specified list, and attempts to modify the returned list, whether
  direct or via its iterator, result in an
  <tt>UnsupportedOperationException</tt>.<p>
  
  The returned list will be serializable if the specified list
  is serializable. Similarly, the returned list will implement
  {@link RandomAccess} if the specified list does.
  
  @param  <T> the class of the objects in the list
  @param  list the list for which an unmodifiable view is to be returned.
  @return an unmodifiable view of the specified list.