public static < T > Set < T > toImmutableSet ( final Set < ? extends T > set ) { switch ( set . size ( ) ) { case 0 : return Collections . emptySet ( ) ; case 1 : return Collections . singleton ( set . iterator ( ) . next ( ) ) ; default : return Collections . unmodifiableSet ( set ) ; } }
list to imuteable set .