View Javadoc
1   /*
2    * Copyright (C) 2015 The Guava Authors
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  
17  package com.google.common.collect;
18  
19  import com.google.common.annotations.GwtIncompatible;
20  import java.util.function.BinaryOperator;
21  import java.util.function.Function;
22  import java.util.stream.Collector;
23  
24  /**
25   * "Overrides" the {@link ImmutableMap} static methods that lack
26   * {@link ImmutableBiMap} equivalents with deprecated, exception-throwing
27   * versions. See {@link ImmutableSortedSetFauxverideShim} for details.
28   *
29   * @author Louis Wasserman
30   */
31  @GwtIncompatible
32  abstract class ImmutableBiMapFauxverideShim<K, V> extends ImmutableMap<K, V> {
33    /**
34     * Not supported. Use {@link ImmutableBiMap#toImmutableBiMap} instead. This method exists only to
35     * hide {@link ImmutableMap#toImmutableMap(Function, Function)} from consumers of {@code
36     * ImmutableBiMap}.
37     *
38     * @throws UnsupportedOperationException always
39     * @deprecated Use {@link ImmutableBiMap#toImmutableBiMap}.
40     */
41    @Deprecated
42    public static <T, K, V> Collector<T, ?, ImmutableMap<K, V>> toImmutableMap(
43        Function<? super T, ? extends K> keyFunction,
44        Function<? super T, ? extends V> valueFunction) {
45      throw new UnsupportedOperationException();
46    }
47    
48    /**
49     * Not supported. This method does not make sense for {@code BiMap}. This method exists only to
50     * hide {@link ImmutableMap#toImmutableMap(Function, Function, BinaryOperator)} from consumers of
51     * {@code ImmutableBiMap}.
52     *
53     * @throws UnsupportedOperationException always
54     * @deprecated
55     */
56    @Deprecated
57    public static <T, K, V> Collector<T, ?, ImmutableMap<K, V>> toImmutableMap(
58        Function<? super T, ? extends K> keyFunction,
59        Function<? super T, ? extends V> valueFunction,
60        BinaryOperator<V> mergeFunction) {
61      throw new UnsupportedOperationException();
62    }
63  }