19
19
import static com .google .common .collect .CollectPreconditions .checkEntryNotNull ;
20
20
import static com .google .common .collect .CollectPreconditions .checkNonnegative ;
21
21
22
+ import com .google .common .annotations .Beta ;
22
23
import com .google .common .annotations .GwtCompatible ;
23
24
import com .google .common .annotations .J2ktIncompatible ;
24
25
import com .google .errorprone .annotations .CanIgnoreReturnValue ;
@@ -56,12 +57,16 @@ public abstract class ImmutableBiMap<K, V> extends ImmutableMap<K, V> implements
56
57
* Object#equals(Object)}), an {@code IllegalArgumentException} is thrown when the collection
57
58
* operation is performed. (This differs from the {@code Collector} returned by {@link
58
59
* Collectors#toMap(Function, Function)}, which throws an {@code IllegalStateException}.)
60
+ *
61
+ * @since NEXT (available since 21.0 in guava-jre)
59
62
*/
60
63
@ SuppressWarnings ({"AndroidJdkLibsChecker" , "Java7ApiChecker" })
61
64
@ IgnoreJRERequirement // Users will use this only if they're already using streams.
62
- static <T extends @ Nullable Object , K , V > Collector <T , ?, ImmutableBiMap <K , V >> toImmutableBiMap (
63
- Function <? super T , ? extends K > keyFunction ,
64
- Function <? super T , ? extends V > valueFunction ) {
65
+ @ Beta // TODO: b/288085449 - Remove.
66
+ public static <T extends @ Nullable Object , K , V >
67
+ Collector <T , ?, ImmutableBiMap <K , V >> toImmutableBiMap (
68
+ Function <? super T , ? extends K > keyFunction ,
69
+ Function <? super T , ? extends V > valueFunction ) {
65
70
return CollectCollectors .toImmutableBiMap (keyFunction , valueFunction );
66
71
}
67
72
@@ -621,14 +626,17 @@ private void readObject(ObjectInputStream stream) throws InvalidObjectException
621
626
*
622
627
* @throws UnsupportedOperationException always
623
628
* @deprecated Use {@link ImmutableBiMap#toImmutableBiMap}.
629
+ * @since NEXT (available since 21.0 in guava-jre)
624
630
*/
625
631
@ Deprecated
626
632
@ DoNotCall ("Use toImmutableBiMap" )
627
633
@ SuppressWarnings ({"AndroidJdkLibsChecker" , "Java7ApiChecker" })
628
634
@ IgnoreJRERequirement // Users will use this only if they're already using streams.
629
- static <T extends @ Nullable Object , K , V > Collector <T , ?, ImmutableMap <K , V >> toImmutableMap (
630
- Function <? super T , ? extends K > keyFunction ,
631
- Function <? super T , ? extends V > valueFunction ) {
635
+ @ Beta // TODO: b/288085449 - Remove.
636
+ public static <T extends @ Nullable Object , K , V >
637
+ Collector <T , ?, ImmutableMap <K , V >> toImmutableMap (
638
+ Function <? super T , ? extends K > keyFunction ,
639
+ Function <? super T , ? extends V > valueFunction ) {
632
640
throw new UnsupportedOperationException ();
633
641
}
634
642
@@ -639,15 +647,18 @@ private void readObject(ObjectInputStream stream) throws InvalidObjectException
639
647
*
640
648
* @throws UnsupportedOperationException always
641
649
* @deprecated
650
+ * @since NEXT (available since 21.0 in guava-jre)
642
651
*/
643
652
@ Deprecated
644
653
@ DoNotCall ("Use toImmutableBiMap" )
645
654
@ SuppressWarnings ({"AndroidJdkLibsChecker" , "Java7ApiChecker" })
646
655
@ IgnoreJRERequirement // Users will use this only if they're already using streams.
647
- static <T extends @ Nullable Object , K , V > Collector <T , ?, ImmutableMap <K , V >> toImmutableMap (
648
- Function <? super T , ? extends K > keyFunction ,
649
- Function <? super T , ? extends V > valueFunction ,
650
- BinaryOperator <V > mergeFunction ) {
656
+ @ Beta // TODO: b/288085449 - Remove.
657
+ public static <T extends @ Nullable Object , K , V >
658
+ Collector <T , ?, ImmutableMap <K , V >> toImmutableMap (
659
+ Function <? super T , ? extends K > keyFunction ,
660
+ Function <? super T , ? extends V > valueFunction ,
661
+ BinaryOperator <V > mergeFunction ) {
651
662
throw new UnsupportedOperationException ();
652
663
}
653
664
0 commit comments