diff --git a/android/guava/src/com/google/common/collect/Comparators.java b/android/guava/src/com/google/common/collect/Comparators.java index cf01e60c307e..ffc2f4df7495 100644 --- a/android/guava/src/com/google/common/collect/Comparators.java +++ b/android/guava/src/com/google/common/collect/Comparators.java @@ -19,6 +19,7 @@ import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.collect.CollectPreconditions.checkNonnegative; +import com.google.common.annotations.Beta; import com.google.common.annotations.GwtCompatible; import java.util.Comparator; import java.util.Iterator; @@ -127,10 +128,12 @@ private Comparators() {} * log n) time and O(n) space. * * @throws IllegalArgumentException if {@code k < 0} + * @since NEXT (available since 22.0 in guava-jre) */ @SuppressWarnings({"AndroidJdkLibsChecker", "Java7ApiChecker"}) @IgnoreJRERequirement // Users will use this only if they're already using streams. - static Collector> least( + @Beta // TODO: b/288085449 - Remove. + public static Collector> least( int k, Comparator comparator) { checkNonnegative(k, "k"); checkNotNull(comparator); @@ -160,10 +163,12 @@ private Comparators() {} * takes O(n log n) time and O(n) space. * * @throws IllegalArgumentException if {@code k < 0} + * @since NEXT (available since 22.0 in guava-jre) */ @SuppressWarnings({"AndroidJdkLibsChecker", "Java7ApiChecker"}) @IgnoreJRERequirement // Users will use this only if they're already using streams. - static Collector> greatest( + @Beta // TODO: b/288085449 - Remove. + public static Collector> greatest( int k, Comparator comparator) { return least(k, comparator.reversed()); } diff --git a/android/guava/src/com/google/common/collect/ImmutableBiMap.java b/android/guava/src/com/google/common/collect/ImmutableBiMap.java index d18d5b6f1ff0..564fe2ee1e44 100644 --- a/android/guava/src/com/google/common/collect/ImmutableBiMap.java +++ b/android/guava/src/com/google/common/collect/ImmutableBiMap.java @@ -19,6 +19,7 @@ import static com.google.common.collect.CollectPreconditions.checkEntryNotNull; import static com.google.common.collect.CollectPreconditions.checkNonnegative; +import com.google.common.annotations.Beta; import com.google.common.annotations.GwtCompatible; import com.google.common.annotations.J2ktIncompatible; import com.google.errorprone.annotations.CanIgnoreReturnValue; @@ -56,12 +57,16 @@ public abstract class ImmutableBiMap extends ImmutableMap implements * Object#equals(Object)}), an {@code IllegalArgumentException} is thrown when the collection * operation is performed. (This differs from the {@code Collector} returned by {@link * Collectors#toMap(Function, Function)}, which throws an {@code IllegalStateException}.) + * + * @since NEXT (available since 21.0 in guava-jre) */ @SuppressWarnings({"AndroidJdkLibsChecker", "Java7ApiChecker"}) @IgnoreJRERequirement // Users will use this only if they're already using streams. - static Collector> toImmutableBiMap( - Function keyFunction, - Function valueFunction) { + @Beta // TODO: b/288085449 - Remove. + public static + Collector> toImmutableBiMap( + Function keyFunction, + Function valueFunction) { return CollectCollectors.toImmutableBiMap(keyFunction, valueFunction); } @@ -621,14 +626,17 @@ private void readObject(ObjectInputStream stream) throws InvalidObjectException * * @throws UnsupportedOperationException always * @deprecated Use {@link ImmutableBiMap#toImmutableBiMap}. + * @since NEXT (available since 21.0 in guava-jre) */ @Deprecated @DoNotCall("Use toImmutableBiMap") @SuppressWarnings({"AndroidJdkLibsChecker", "Java7ApiChecker"}) @IgnoreJRERequirement // Users will use this only if they're already using streams. - static Collector> toImmutableMap( - Function keyFunction, - Function valueFunction) { + @Beta // TODO: b/288085449 - Remove. + public static + Collector> toImmutableMap( + Function keyFunction, + Function valueFunction) { throw new UnsupportedOperationException(); } @@ -639,15 +647,18 @@ private void readObject(ObjectInputStream stream) throws InvalidObjectException * * @throws UnsupportedOperationException always * @deprecated + * @since NEXT (available since 21.0 in guava-jre) */ @Deprecated @DoNotCall("Use toImmutableBiMap") @SuppressWarnings({"AndroidJdkLibsChecker", "Java7ApiChecker"}) @IgnoreJRERequirement // Users will use this only if they're already using streams. - static Collector> toImmutableMap( - Function keyFunction, - Function valueFunction, - BinaryOperator mergeFunction) { + @Beta // TODO: b/288085449 - Remove. + public static + Collector> toImmutableMap( + Function keyFunction, + Function valueFunction, + BinaryOperator mergeFunction) { throw new UnsupportedOperationException(); } diff --git a/android/guava/src/com/google/common/collect/ImmutableList.java b/android/guava/src/com/google/common/collect/ImmutableList.java index 30328bb6f33e..c3dc6620a584 100644 --- a/android/guava/src/com/google/common/collect/ImmutableList.java +++ b/android/guava/src/com/google/common/collect/ImmutableList.java @@ -25,6 +25,7 @@ import static com.google.common.collect.ObjectArrays.checkElementsNotNull; import static com.google.common.collect.RegularImmutableList.EMPTY; +import com.google.common.annotations.Beta; import com.google.common.annotations.GwtCompatible; import com.google.common.annotations.GwtIncompatible; import com.google.common.annotations.J2ktIncompatible; @@ -66,10 +67,13 @@ public abstract class ImmutableList extends ImmutableCollection /** * Returns a {@code Collector} that accumulates the input elements into a new {@code * ImmutableList}, in encounter order. + * + * @since NEXT (available since 21.0 in guava-jre) */ @SuppressWarnings({"AndroidJdkLibsChecker", "Java7ApiChecker"}) @IgnoreJRERequirement // Users will use this only if they're already using streams. - static Collector> toImmutableList() { + @Beta // TODO: b/288085449 - Remove. + public static Collector> toImmutableList() { return CollectCollectors.toImmutableList(); } diff --git a/android/guava/src/com/google/common/collect/ImmutableListMultimap.java b/android/guava/src/com/google/common/collect/ImmutableListMultimap.java index deab19d8a178..4d7043699f8b 100644 --- a/android/guava/src/com/google/common/collect/ImmutableListMultimap.java +++ b/android/guava/src/com/google/common/collect/ImmutableListMultimap.java @@ -18,6 +18,7 @@ import static java.util.Objects.requireNonNull; +import com.google.common.annotations.Beta; import com.google.common.annotations.GwtCompatible; import com.google.common.annotations.GwtIncompatible; import com.google.common.annotations.J2ktIncompatible; @@ -78,10 +79,13 @@ public class ImmutableListMultimap extends ImmutableMultimap * .putAll('c', "arrot", "herry") * .build(); * } + * + * @since NEXT (available since 21.0 in guava-jre) */ @SuppressWarnings({"AndroidJdkLibsChecker", "Java7ApiChecker"}) @IgnoreJRERequirement // Users will use this only if they're already using streams. - static + @Beta // TODO: b/288085449 - Remove. + public static Collector> toImmutableListMultimap( Function keyFunction, Function valueFunction) { @@ -116,10 +120,13 @@ public class ImmutableListMultimap extends ImmutableMultimap * .build(); * } * } + * + * @since NEXT (available since 21.0 in guava-jre) */ @SuppressWarnings({"AndroidJdkLibsChecker", "Java7ApiChecker"}) @IgnoreJRERequirement // Users will use this only if they're already using streams. - static + @Beta // TODO: b/288085449 - Remove. + public static Collector> flatteningToImmutableListMultimap( Function keyFunction, Function> valuesFunction) { diff --git a/android/guava/src/com/google/common/collect/ImmutableMap.java b/android/guava/src/com/google/common/collect/ImmutableMap.java index 7b91cafc25ab..c88705b37ba7 100644 --- a/android/guava/src/com/google/common/collect/ImmutableMap.java +++ b/android/guava/src/com/google/common/collect/ImmutableMap.java @@ -22,6 +22,7 @@ import static com.google.common.collect.CollectPreconditions.checkNonnegative; import static java.util.Objects.requireNonNull; +import com.google.common.annotations.Beta; import com.google.common.annotations.GwtCompatible; import com.google.common.annotations.GwtIncompatible; import com.google.common.annotations.J2ktIncompatible; @@ -79,12 +80,16 @@ public abstract class ImmutableMap implements Map, Serializable { * IllegalArgumentException} is thrown when the collection operation is performed. (This differs * from the {@code Collector} returned by {@link Collectors#toMap(Function, Function)}, which * throws an {@code IllegalStateException}.) + * + * @since NEXT (available since 21.0 in guava-jre) */ @SuppressWarnings({"AndroidJdkLibsChecker", "Java7ApiChecker"}) @IgnoreJRERequirement // Users will use this only if they're already using streams. - static Collector> toImmutableMap( - Function keyFunction, - Function valueFunction) { + @Beta // TODO: b/288085449 - Remove. + public static + Collector> toImmutableMap( + Function keyFunction, + Function valueFunction) { return CollectCollectors.toImmutableMap(keyFunction, valueFunction); } @@ -98,13 +103,17 @@ public abstract class ImmutableMap implements Map, Serializable { * future occurrences of the key would reinsert it). * *

Entries will appear in the encounter order of the first occurrence of the key. + * + * @since NEXT (available since 21.0 in guava-jre) */ @SuppressWarnings({"AndroidJdkLibsChecker", "Java7ApiChecker"}) @IgnoreJRERequirement // Users will use this only if they're already using streams. - static Collector> toImmutableMap( - Function keyFunction, - Function valueFunction, - BinaryOperator mergeFunction) { + @Beta // TODO: b/288085449 - Remove. + public static + Collector> toImmutableMap( + Function keyFunction, + Function valueFunction, + BinaryOperator mergeFunction) { return CollectCollectors.toImmutableMap(keyFunction, valueFunction, mergeFunction); } diff --git a/android/guava/src/com/google/common/collect/ImmutableMultiset.java b/android/guava/src/com/google/common/collect/ImmutableMultiset.java index 4612e30c119f..7a1057cdfd9a 100644 --- a/android/guava/src/com/google/common/collect/ImmutableMultiset.java +++ b/android/guava/src/com/google/common/collect/ImmutableMultiset.java @@ -19,6 +19,7 @@ import static com.google.common.base.Preconditions.checkNotNull; import static java.util.Objects.requireNonNull; +import com.google.common.annotations.Beta; import com.google.common.annotations.GwtCompatible; import com.google.common.annotations.GwtIncompatible; import com.google.common.annotations.J2ktIncompatible; @@ -64,10 +65,13 @@ public abstract class ImmutableMultiset extends ImmutableMultisetGwtSerializa * Returns a {@code Collector} that accumulates the input elements into a new {@code * ImmutableMultiset}. Elements iterate in order by the first appearance of that element in * encounter order. + * + * @since NEXT (available since 21.0 in guava-jre) */ @SuppressWarnings({"AndroidJdkLibsChecker", "Java7ApiChecker"}) @IgnoreJRERequirement // Users will use this only if they're already using streams. - static Collector> toImmutableMultiset() { + @Beta // TODO: b/288085449 - Remove. + public static Collector> toImmutableMultiset() { return CollectCollectors.toImmutableMultiset(Function.identity(), e -> 1); } @@ -79,11 +83,16 @@ public abstract class ImmutableMultiset extends ImmutableMultisetGwtSerializa *

If the mapped elements contain duplicates (according to {@link Object#equals}), the first * occurrence in encounter order appears in the resulting multiset, with count equal to the sum of * the outputs of {@code countFunction.applyAsInt(t)} for each {@code t} mapped to that element. + * + * @since NEXT (available since 22.0 in guava-jre) */ @SuppressWarnings({"AndroidJdkLibsChecker", "Java7ApiChecker"}) @IgnoreJRERequirement // Users will use this only if they're already using streams. - static Collector> toImmutableMultiset( - Function elementFunction, ToIntFunction countFunction) { + @Beta // TODO: b/288085449 - Remove. + public static + Collector> toImmutableMultiset( + Function elementFunction, + ToIntFunction countFunction) { return CollectCollectors.toImmutableMultiset(elementFunction, countFunction); } diff --git a/android/guava/src/com/google/common/collect/ImmutableRangeMap.java b/android/guava/src/com/google/common/collect/ImmutableRangeMap.java index 7d52da8a50c3..bc2143d6c512 100644 --- a/android/guava/src/com/google/common/collect/ImmutableRangeMap.java +++ b/android/guava/src/com/google/common/collect/ImmutableRangeMap.java @@ -18,6 +18,7 @@ import static com.google.common.base.Preconditions.checkElementIndex; import static com.google.common.base.Preconditions.checkNotNull; +import com.google.common.annotations.Beta; import com.google.common.annotations.GwtIncompatible; import com.google.common.annotations.J2ktIncompatible; import com.google.common.collect.SortedLists.KeyAbsentBehavior; @@ -55,10 +56,13 @@ public class ImmutableRangeMap, V> implements RangeMap, V> + @Beta // TODO: b/288085449 - Remove. + public static , V> Collector> toImmutableRangeMap( Function> keyFunction, Function valueFunction) { diff --git a/android/guava/src/com/google/common/collect/ImmutableRangeSet.java b/android/guava/src/com/google/common/collect/ImmutableRangeSet.java index ac31fae5f68f..458cb59449c2 100644 --- a/android/guava/src/com/google/common/collect/ImmutableRangeSet.java +++ b/android/guava/src/com/google/common/collect/ImmutableRangeSet.java @@ -22,6 +22,7 @@ import static com.google.common.collect.SortedLists.KeyPresentBehavior.ANY_PRESENT; import static java.util.Objects.requireNonNull; +import com.google.common.annotations.Beta; import com.google.common.annotations.GwtIncompatible; import com.google.common.annotations.J2ktIncompatible; import com.google.common.collect.SortedLists.KeyAbsentBehavior; @@ -64,10 +65,13 @@ public final class ImmutableRangeSet extends AbstractRange * Returns a {@code Collector} that accumulates the input elements into a new {@code * ImmutableRangeSet}. As in {@link Builder}, overlapping ranges are not permitted and adjacent * ranges will be merged. + * + * @since NEXT (available since 23.1 in guava-jre) */ @SuppressWarnings({"AndroidJdkLibsChecker", "Java7ApiChecker"}) @IgnoreJRERequirement // Users will use this only if they're already using streams. - static > + @Beta // TODO: b/288085449 - Remove. + public static > Collector, ?, ImmutableRangeSet> toImmutableRangeSet() { return CollectCollectors.toImmutableRangeSet(); } diff --git a/android/guava/src/com/google/common/collect/ImmutableSet.java b/android/guava/src/com/google/common/collect/ImmutableSet.java index 54dda3208fa4..41d66311fcff 100644 --- a/android/guava/src/com/google/common/collect/ImmutableSet.java +++ b/android/guava/src/com/google/common/collect/ImmutableSet.java @@ -22,6 +22,7 @@ import static com.google.common.collect.ObjectArrays.checkElementNotNull; import static java.util.Objects.requireNonNull; +import com.google.common.annotations.Beta; import com.google.common.annotations.GwtCompatible; import com.google.common.annotations.J2ktIncompatible; import com.google.common.annotations.VisibleForTesting; @@ -58,10 +59,13 @@ public abstract class ImmutableSet extends ImmutableCollection implements * ImmutableSet}. Elements appear in the resulting set in the encounter order of the stream; if * the stream contains duplicates (according to {@link Object#equals(Object)}), only the first * duplicate in encounter order will appear in the result. + * + * @since NEXT (available since 21.0 in guava-jre) */ @SuppressWarnings({"AndroidJdkLibsChecker", "Java7ApiChecker"}) @IgnoreJRERequirement // Users will use this only if they're already using streams. - static Collector> toImmutableSet() { + @Beta // TODO: b/288085449 - Remove. + public static Collector> toImmutableSet() { return CollectCollectors.toImmutableSet(); } diff --git a/android/guava/src/com/google/common/collect/ImmutableSetMultimap.java b/android/guava/src/com/google/common/collect/ImmutableSetMultimap.java index 0c2ad522b240..57b2db7cdd72 100644 --- a/android/guava/src/com/google/common/collect/ImmutableSetMultimap.java +++ b/android/guava/src/com/google/common/collect/ImmutableSetMultimap.java @@ -19,6 +19,7 @@ import static com.google.common.base.Preconditions.checkNotNull; import static java.util.Objects.requireNonNull; +import com.google.common.annotations.Beta; import com.google.common.annotations.GwtCompatible; import com.google.common.annotations.GwtIncompatible; import com.google.common.annotations.J2ktIncompatible; @@ -86,10 +87,13 @@ public class ImmutableSetMultimap extends ImmutableMultimap * .putAll('c', "arrot", "herry") * .build(); * } + * + * @since NEXT (available since 21.0 in guava-jre) */ @SuppressWarnings({"AndroidJdkLibsChecker", "Java7ApiChecker"}) @IgnoreJRERequirement // Users will use this only if they're already using streams. - static + @Beta // TODO: b/288085449 - Remove. + public static Collector> toImmutableSetMultimap( Function keyFunction, Function valueFunction) { @@ -133,10 +137,13 @@ public class ImmutableSetMultimap extends ImmutableMultimap * .build(); * } * } + * + * @since NEXT (available since 21.0 in guava-jre) */ @SuppressWarnings({"AndroidJdkLibsChecker", "Java7ApiChecker"}) @IgnoreJRERequirement // Users will use this only if they're already using streams. - static + @Beta // TODO: b/288085449 - Remove. + public static Collector> flatteningToImmutableSetMultimap( Function keyFunction, Function> valuesFunction) { diff --git a/android/guava/src/com/google/common/collect/ImmutableSortedMap.java b/android/guava/src/com/google/common/collect/ImmutableSortedMap.java index e9384791c6db..c973eb959faf 100644 --- a/android/guava/src/com/google/common/collect/ImmutableSortedMap.java +++ b/android/guava/src/com/google/common/collect/ImmutableSortedMap.java @@ -22,6 +22,7 @@ import static com.google.common.collect.Maps.keyOrNull; import static java.util.Objects.requireNonNull; +import com.google.common.annotations.Beta; import com.google.common.annotations.GwtCompatible; import com.google.common.annotations.GwtIncompatible; import com.google.common.annotations.J2ktIncompatible; @@ -73,10 +74,13 @@ public final class ImmutableSortedMap extends ImmutableMap * IllegalArgumentException} is thrown when the collection operation is performed. (This differs * from the {@code Collector} returned by {@link Collectors#toMap(Function, Function)}, which * throws an {@code IllegalStateException}.) + * + * @since NEXT (available since 21.0 in guava-jre) */ @SuppressWarnings({"AndroidJdkLibsChecker", "Java7ApiChecker"}) @IgnoreJRERequirement // Users will use this only if they're already using streams. - static + @Beta // TODO: b/288085449 - Remove. + public static Collector> toImmutableSortedMap( Comparator comparator, Function keyFunction, @@ -92,10 +96,13 @@ public final class ImmutableSortedMap extends ImmutableMap *

If the mapped keys contain duplicates (according to the comparator), the values are merged * using the specified merging function. Entries will appear in the encounter order of the first * occurrence of the key. + * + * @since NEXT (available since 21.0 in guava-jre) */ @SuppressWarnings({"AndroidJdkLibsChecker", "Java7ApiChecker"}) @IgnoreJRERequirement // Users will use this only if they're already using streams. - static + @Beta // TODO: b/288085449 - Remove. + public static Collector> toImmutableSortedMap( Comparator comparator, Function keyFunction, @@ -1216,14 +1223,17 @@ private void readObject(ObjectInputStream stream) throws InvalidObjectException * * @throws UnsupportedOperationException always * @deprecated Use {@link ImmutableSortedMap#toImmutableSortedMap}. + * @since NEXT (available since 21.0 in guava-jre) */ @DoNotCall("Use toImmutableSortedMap") @Deprecated @SuppressWarnings({"AndroidJdkLibsChecker", "Java7ApiChecker"}) @IgnoreJRERequirement // Users will use this only if they're already using streams. - static Collector> toImmutableMap( - Function keyFunction, - Function valueFunction) { + @Beta // TODO: b/288085449 - Remove. + public static + Collector> toImmutableMap( + Function keyFunction, + Function valueFunction) { throw new UnsupportedOperationException(); } @@ -1234,15 +1244,18 @@ private void readObject(ObjectInputStream stream) throws InvalidObjectException * * @throws UnsupportedOperationException always * @deprecated Use {@link ImmutableSortedMap#toImmutableSortedMap}. + * @since NEXT (available since 21.0 in guava-jre) */ @DoNotCall("Use toImmutableSortedMap") @Deprecated @SuppressWarnings({"AndroidJdkLibsChecker", "Java7ApiChecker"}) @IgnoreJRERequirement // Users will use this only if they're already using streams. - static Collector> toImmutableMap( - Function keyFunction, - Function valueFunction, - BinaryOperator mergeFunction) { + @Beta // TODO: b/288085449 - Remove. + public static + Collector> toImmutableMap( + Function keyFunction, + Function valueFunction, + BinaryOperator mergeFunction) { throw new UnsupportedOperationException(); } diff --git a/android/guava/src/com/google/common/collect/ImmutableSortedMultiset.java b/android/guava/src/com/google/common/collect/ImmutableSortedMultiset.java index 52362e461fa1..8f86e6e88b6a 100644 --- a/android/guava/src/com/google/common/collect/ImmutableSortedMultiset.java +++ b/android/guava/src/com/google/common/collect/ImmutableSortedMultiset.java @@ -17,6 +17,7 @@ import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkNotNull; +import com.google.common.annotations.Beta; import com.google.common.annotations.GwtIncompatible; import com.google.common.annotations.J2ktIncompatible; import com.google.common.annotations.VisibleForTesting; @@ -67,10 +68,13 @@ public abstract class ImmutableSortedMultiset extends ImmutableMultiset * *

Warning: {@code comparator} should be consistent with {@code equals} as * explained in the {@link Comparator} documentation. + * + * @since NEXT (available since 21.0 in guava-jre) */ @SuppressWarnings({"AndroidJdkLibsChecker", "Java7ApiChecker"}) @IgnoreJRERequirement // Users will use this only if they're already using streams. - static Collector> toImmutableSortedMultiset( + @Beta // TODO: b/288085449 - Remove. + public static Collector> toImmutableSortedMultiset( Comparator comparator) { return toImmutableSortedMultiset(comparator, Function.identity(), e -> 1); } @@ -83,10 +87,13 @@ public abstract class ImmutableSortedMultiset extends ImmutableMultiset *

If the mapped elements contain duplicates (according to {@code comparator}), the first * occurrence in encounter order appears in the resulting multiset, with count equal to the sum of * the outputs of {@code countFunction.applyAsInt(t)} for each {@code t} mapped to that element. + * + * @since NEXT (available since 22.0 in guava-jre) */ @SuppressWarnings({"AndroidJdkLibsChecker", "Java7ApiChecker"}) @IgnoreJRERequirement // Users will use this only if they're already using streams. - static + @Beta // TODO: b/288085449 - Remove. + public static Collector> toImmutableSortedMultiset( Comparator comparator, Function elementFunction, @@ -753,12 +760,14 @@ private void readObject(ObjectInputStream stream) throws InvalidObjectException * * @throws UnsupportedOperationException always * @deprecated Use {@link ImmutableSortedMultiset#toImmutableSortedMultiset}. + * @since NEXT (available since 21.0 in guava-jre) */ @DoNotCall("Use toImmutableSortedMultiset.") @Deprecated @SuppressWarnings({"AndroidJdkLibsChecker", "Java7ApiChecker"}) @IgnoreJRERequirement // Users will use this only if they're already using streams. - static Collector> toImmutableMultiset() { + @Beta // TODO: b/288085449 - Remove. + public static Collector> toImmutableMultiset() { throw new UnsupportedOperationException(); } @@ -769,13 +778,17 @@ private void readObject(ObjectInputStream stream) throws InvalidObjectException * * @throws UnsupportedOperationException always * @deprecated Use {@link ImmutableSortedMultiset#toImmutableSortedMultiset}. + * @since NEXT (available since 22.0 in guava-jre) */ @DoNotCall("Use toImmutableSortedMultiset.") @Deprecated @SuppressWarnings({"AndroidJdkLibsChecker", "Java7ApiChecker"}) @IgnoreJRERequirement // Users will use this only if they're already using streams. - static Collector> toImmutableMultiset( - Function elementFunction, ToIntFunction countFunction) { + @Beta // TODO: b/288085449 - Remove. + public static + Collector> toImmutableMultiset( + Function elementFunction, + ToIntFunction countFunction) { throw new UnsupportedOperationException(); } diff --git a/android/guava/src/com/google/common/collect/ImmutableSortedSet.java b/android/guava/src/com/google/common/collect/ImmutableSortedSet.java index b92d6cf93c83..f119301aa73e 100644 --- a/android/guava/src/com/google/common/collect/ImmutableSortedSet.java +++ b/android/guava/src/com/google/common/collect/ImmutableSortedSet.java @@ -20,6 +20,7 @@ import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.collect.ObjectArrays.checkElementsNotNull; +import com.google.common.annotations.Beta; import com.google.common.annotations.GwtCompatible; import com.google.common.annotations.GwtIncompatible; import com.google.common.annotations.J2ktIncompatible; @@ -69,10 +70,13 @@ public abstract class ImmutableSortedSet extends ImmutableSet * *

If the elements contain duplicates (according to the comparator), only the first duplicate * in encounter order will appear in the result. + * + * @since NEXT (available since 21.0 in guava-jre) */ @SuppressWarnings({"AndroidJdkLibsChecker", "Java7ApiChecker"}) @IgnoreJRERequirement // Users will use this only if they're already using streams. - static Collector> toImmutableSortedSet( + @Beta // TODO: b/288085449 - Remove. + public static Collector> toImmutableSortedSet( Comparator comparator) { return CollectCollectors.toImmutableSortedSet(comparator); } @@ -793,12 +797,14 @@ Object writeReplace() { * * @throws UnsupportedOperationException always * @deprecated Use {@link ImmutableSortedSet#toImmutableSortedSet}. + * @since NEXT (available since 21.0 in guava-jre) */ @DoNotCall("Use toImmutableSortedSet") @Deprecated @SuppressWarnings({"AndroidJdkLibsChecker", "Java7ApiChecker"}) @IgnoreJRERequirement // Users will use this only if they're already using streams. - static Collector> toImmutableSet() { + @Beta // TODO: b/288085449 - Remove. + public static Collector> toImmutableSet() { throw new UnsupportedOperationException(); } diff --git a/android/guava/src/com/google/common/collect/ImmutableTable.java b/android/guava/src/com/google/common/collect/ImmutableTable.java index 91c9f71a633e..20fa98c5c832 100644 --- a/android/guava/src/com/google/common/collect/ImmutableTable.java +++ b/android/guava/src/com/google/common/collect/ImmutableTable.java @@ -18,6 +18,7 @@ import static com.google.common.base.Preconditions.checkNotNull; +import com.google.common.annotations.Beta; import com.google.common.annotations.GwtCompatible; import com.google.common.annotations.GwtIncompatible; import com.google.common.annotations.J2ktIncompatible; @@ -60,10 +61,13 @@ public abstract class ImmutableTable extends AbstractTable * *

The returned {@code Collector} will throw a {@code NullPointerException} at collection time * if the row, column, or value functions return null on any input. + * + * @since NEXT (available since 21.0 in guava-jre) */ @SuppressWarnings({"AndroidJdkLibsChecker", "Java7ApiChecker"}) @IgnoreJRERequirement // Users will use this only if they're already using streams. - static + @Beta // TODO: b/288085449 - Remove. + public static Collector> toImmutableTable( Function rowFunction, Function columnFunction, @@ -79,10 +83,13 @@ public abstract class ImmutableTable extends AbstractTable * *

The returned {@code Collector} will throw a {@code NullPointerException} at collection time * if the row, column, value, or merging functions return null on any input. + * + * @since NEXT (available since 21.0 in guava-jre) */ @SuppressWarnings({"AndroidJdkLibsChecker", "Java7ApiChecker"}) @IgnoreJRERequirement // Users will use this only if they're already using streams. - static + @Beta // TODO: b/288085449 - Remove. + public static Collector> toImmutableTable( Function rowFunction, Function columnFunction, diff --git a/android/guava/src/com/google/common/collect/Maps.java b/android/guava/src/com/google/common/collect/Maps.java index 01f0ee2bf211..6171c476c7d0 100644 --- a/android/guava/src/com/google/common/collect/Maps.java +++ b/android/guava/src/com/google/common/collect/Maps.java @@ -25,6 +25,7 @@ import static java.util.Collections.singletonMap; import static java.util.Objects.requireNonNull; +import com.google.common.annotations.Beta; import com.google.common.annotations.GwtCompatible; import com.google.common.annotations.GwtIncompatible; import com.google.common.annotations.J2ktIncompatible; @@ -189,10 +190,13 @@ public static , V> ImmutableMap immutableEnumMap( * {@link java.util.stream.Collectors#toMap(java.util.function.Function, * java.util.function.Function) Collectors.toMap(Function, Function)}, which throws an {@code * IllegalStateException}.) + * + * @since NEXT (available since 21.0 in guava-jre) */ @SuppressWarnings({"AndroidJdkLibsChecker", "Java7ApiChecker"}) @IgnoreJRERequirement // Users will use this only if they're already using streams. - static , V> + @Beta // TODO: b/288085449 - Remove. + public static , V> Collector> toImmutableEnumMap( java.util.function.Function keyFunction, java.util.function.Function valueFunction) { @@ -207,10 +211,13 @@ public static , V> ImmutableMap immutableEnumMap( * *

If the mapped keys contain duplicates, the values are merged using the specified merging * function. + * + * @since NEXT (available since 21.0 in guava-jre) */ @SuppressWarnings({"AndroidJdkLibsChecker", "Java7ApiChecker"}) @IgnoreJRERequirement // Users will use this only if they're already using streams. - static , V> + @Beta // TODO: b/288085449 - Remove. + public static , V> Collector> toImmutableEnumMap( java.util.function.Function keyFunction, java.util.function.Function valueFunction, diff --git a/android/guava/src/com/google/common/collect/MoreCollectors.java b/android/guava/src/com/google/common/collect/MoreCollectors.java index 02b254d2d54c..8d5a41495c35 100644 --- a/android/guava/src/com/google/common/collect/MoreCollectors.java +++ b/android/guava/src/com/google/common/collect/MoreCollectors.java @@ -19,6 +19,7 @@ import static com.google.common.base.Preconditions.checkNotNull; import static java.util.Collections.emptyList; +import com.google.common.annotations.Beta; import com.google.common.annotations.GwtCompatible; import java.util.ArrayList; import java.util.List; @@ -33,12 +34,14 @@ * with a {@code com.google.common} type. * * @author Louis Wasserman + * @since NEXT (available since 21.0 in guava-jre) */ @GwtCompatible @ElementTypesAreNonnullByDefault @SuppressWarnings({"AndroidJdkLibsChecker", "Java7ApiChecker"}) @IgnoreJRERequirement // Users will use this only if they're already using streams. -final class MoreCollectors { +@Beta // TODO: b/288085449 - Remove. +public final class MoreCollectors { /* * TODO(lowasser): figure out if we can convert this to a concurrent AtomicReference-based diff --git a/android/guava/src/com/google/common/collect/Multimaps.java b/android/guava/src/com/google/common/collect/Multimaps.java index 3b113ff82ebb..51a380cfb5fe 100644 --- a/android/guava/src/com/google/common/collect/Multimaps.java +++ b/android/guava/src/com/google/common/collect/Multimaps.java @@ -22,6 +22,7 @@ import static com.google.common.collect.NullnessCasts.uncheckedCastNullableTToT; import static java.util.Objects.requireNonNull; +import com.google.common.annotations.Beta; import com.google.common.annotations.GwtCompatible; import com.google.common.annotations.GwtIncompatible; import com.google.common.annotations.J2ktIncompatible; @@ -107,10 +108,13 @@ private Multimaps() {} *

To collect to an {@link ImmutableMultimap}, use either {@link * ImmutableSetMultimap#toImmutableSetMultimap} or {@link * ImmutableListMultimap#toImmutableListMultimap}. + * + * @since NEXT (available since 21.0 in guava-jre) */ @SuppressWarnings({"AndroidJdkLibsChecker", "Java7ApiChecker"}) @IgnoreJRERequirement // Users will use this only if they're already using streams. - static < + @Beta // TODO: b/288085449 - Remove. + public static < T extends @Nullable Object, K extends @Nullable Object, V extends @Nullable Object, @@ -152,10 +156,13 @@ private Multimaps() {} * FIRST_LETTER_MULTIMAP.putAll('c', Arrays.asList('h', 'e', 'r', 'r', 'y')); * } * } + * + * @since NEXT (available since 21.0 in guava-jre) */ @SuppressWarnings({"AndroidJdkLibsChecker", "Java7ApiChecker"}) @IgnoreJRERequirement // Users will use this only if they're already using streams. - static < + @Beta // TODO: b/288085449 - Remove. + public static < T extends @Nullable Object, K extends @Nullable Object, V extends @Nullable Object, diff --git a/android/guava/src/com/google/common/collect/Multisets.java b/android/guava/src/com/google/common/collect/Multisets.java index b477391be61f..19f98628be38 100644 --- a/android/guava/src/com/google/common/collect/Multisets.java +++ b/android/guava/src/com/google/common/collect/Multisets.java @@ -22,6 +22,7 @@ import static com.google.common.collect.CollectPreconditions.checkRemove; import static java.util.Objects.requireNonNull; +import com.google.common.annotations.Beta; import com.google.common.annotations.GwtCompatible; import com.google.common.base.Objects; import com.google.common.base.Predicate; @@ -77,10 +78,13 @@ private Multisets() {} * *

To collect to an {@link ImmutableMultiset}, use {@link * ImmutableMultiset#toImmutableMultiset}. + * + * @since NEXT (available since 22.0 in guava-jre) */ @SuppressWarnings({"AndroidJdkLibsChecker", "Java7ApiChecker"}) @IgnoreJRERequirement // Users will use this only if they're already using streams. - static > + @Beta // TODO: b/288085449 - Remove. + public static > Collector toMultiset( Function elementFunction, ToIntFunction countFunction, diff --git a/android/guava/src/com/google/common/collect/Sets.java b/android/guava/src/com/google/common/collect/Sets.java index 5fd70fdceae6..22b65199370f 100644 --- a/android/guava/src/com/google/common/collect/Sets.java +++ b/android/guava/src/com/google/common/collect/Sets.java @@ -20,6 +20,7 @@ import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.collect.CollectPreconditions.checkNonnegative; +import com.google.common.annotations.Beta; import com.google.common.annotations.GwtCompatible; import com.google.common.annotations.GwtIncompatible; import com.google.common.annotations.J2ktIncompatible; @@ -144,10 +145,13 @@ public static > ImmutableSet immutableEnumSet(Iterable e * Returns a {@code Collector} that accumulates the input elements into a new {@code ImmutableSet} * with an implementation specialized for enums. Unlike {@link ImmutableSet#toImmutableSet}, the * resulting set will iterate over elements in their enum definition order, not encounter order. + * + * @since NEXT (available since 21.0 in guava-jre) */ @SuppressWarnings({"AndroidJdkLibsChecker", "Java7ApiChecker"}) @IgnoreJRERequirement // Users will use this only if they're already using streams. - static > Collector> toImmutableEnumSet() { + @Beta // TODO: b/288085449 - Remove. + public static > Collector> toImmutableEnumSet() { return CollectCollectors.toImmutableEnumSet(); } diff --git a/android/guava/src/com/google/common/collect/Tables.java b/android/guava/src/com/google/common/collect/Tables.java index ba276d510abb..bd2137cfcb36 100644 --- a/android/guava/src/com/google/common/collect/Tables.java +++ b/android/guava/src/com/google/common/collect/Tables.java @@ -20,6 +20,7 @@ import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.collect.NullnessCasts.uncheckedCastNullableTToT; +import com.google.common.annotations.Beta; import com.google.common.annotations.GwtCompatible; import com.google.common.base.Function; import com.google.common.base.Objects; @@ -62,10 +63,13 @@ private Tables() {} * is thrown when the collection operation is performed. * *

To collect to an {@link ImmutableTable}, use {@link ImmutableTable#toImmutableTable}. + * + * @since NEXT (available since 21.0 in guava-jre) */ @SuppressWarnings({"AndroidJdkLibsChecker", "Java7ApiChecker"}) @IgnoreJRERequirement // Users will use this only if they're already using streams. - static < + @Beta // TODO: b/288085449 - Remove. + public static < T extends @Nullable Object, R extends @Nullable Object, C extends @Nullable Object, @@ -91,10 +95,13 @@ private Tables() {} * BinaryOperator, java.util.function.Supplier)}, this Collector throws a {@code * NullPointerException} on null values returned from {@code valueFunction}, and treats nulls * returned from {@code mergeFunction} as removals of that row/column pair. + * + * @since NEXT (available since 21.0 in guava-jre) */ @SuppressWarnings({"AndroidJdkLibsChecker", "Java7ApiChecker"}) @IgnoreJRERequirement // Users will use this only if they're already using streams. - static < + @Beta // TODO: b/288085449 - Remove. + public static < T extends @Nullable Object, R extends @Nullable Object, C extends @Nullable Object,