public static < T > List < T > copyOf ( Collection < T > source ) { Preconditions . checkNotNull ( source ) ; if ( source instanceof ImmutableList < ? > ) { return ( ImmutableList < T > ) source ; } if ( source . isEmpty ( ) ) { return Collections . emptyList ( ) ; } return ofInternal ( source . toArray ( ) ) ; }
Creates an immutable list that consists of the elements in the given collection . If the given collection is already an immutable list it is returned directly .