@ Beta public static < K , V > ImmutableBiMap < K , V > copyOf ( Iterable < ? extends Entry < ? extends K , ? extends V > > entries ) { Entry < ? , ? > [ ] entryArray = Iterables . toArray ( entries , EMPTY_ENTRY_ARRAY ) ; switch ( entryArray . length ) { case 0 : return of ( ) ; case 1 : @ SuppressWarnings ( "unchecked" ) // safe covariant cast in this context Entry < K , V > entry = ( Entry < K , V > ) entryArray [ 0 ] ; return of ( entry . getKey ( ) , entry . getValue ( ) ) ; default : return new RegularImmutableBiMap < K , V > ( entryArray ) ; } }
Returns an immutable bimap containing the given entries .