public static < T > List < T > toImmutableList ( final List < ? extends T > list ) { switch ( list . size ( ) ) { case 0 : return Collections . emptyList ( ) ; case 1 : return Collections . singletonList ( list . get ( 0 ) ) ; default : return Collections . unmodifiableList ( list ) ; } }
list to imuteable list .