) iterable;
- }
-
/**
* Returns a {@link Collection} of all the permutations of the specified {@link Iterable}.
*
diff --git a/src/main/java/com/google/common/collect/Comparators.java b/src/main/java/com/google/common/collect/Comparators.java
index 06b398f..b71e8b4 100644
--- a/src/main/java/com/google/common/collect/Comparators.java
+++ b/src/main/java/com/google/common/collect/Comparators.java
@@ -190,4 +190,79 @@ public final class Comparators {
checkNotNull(valueComparator);
return Comparator.comparing(o -> o.orElse(null), Comparator.nullsLast(valueComparator));
}
+ /**
+ * Returns the minimum of the two values. If the values compare as 0, the first is returned.
+ *
+ * The recommended solution for finding the {@code minimum} of some values depends on the type
+ * of your data and the number of elements you have. Read more in the Guava User Guide article on
+ * {@code
+ * Comparators}.
+ *
+ * @param a first value to compare, returned if less than or equal to b.
+ * @param b second value to compare.
+ * @throws ClassCastException if the parameters are not mutually comparable.
+ * @since 30.0
+ */
+ @Beta
+ public static > T min(T a, T b) {
+ return (a.compareTo(b) <= 0) ? a : b;
+ }
+
+ /**
+ * Returns the minimum of the two values, according to the given comparator. If the values compare
+ * as equal, the first is returned.
+ *
+ * The recommended solution for finding the {@code minimum} of some values depends on the type
+ * of your data and the number of elements you have. Read more in the Guava User Guide article on
+ * {@code
+ * Comparators}.
+ *
+ * @param a first value to compare, returned if less than or equal to b
+ * @param b second value to compare.
+ * @throws ClassCastException if the parameters are not mutually comparable using the given
+ * comparator.
+ * @since 30.0
+ */
+ @Beta
+ public static T min(T a, T b, Comparator comparator) {
+ return (comparator.compare(a, b) <= 0) ? a : b;
+ }
+
+ /**
+ * Returns the maximum of the two values. If the values compare as 0, the first is returned.
+ *
+ * The recommended solution for finding the {@code maximum} of some values depends on the type
+ * of your data and the number of elements you have. Read more in the Guava User Guide article on
+ * {@code
+ * Comparators}.
+ *
+ * @param a first value to compare, returned if greater than or equal to b.
+ * @param b second value to compare.
+ * @throws ClassCastException if the parameters are not mutually comparable.
+ * @since 30.0
+ */
+ @Beta
+ public static > T max(T a, T b) {
+ return (a.compareTo(b) >= 0) ? a : b;
+ }
+
+ /**
+ * Returns the maximum of the two values, according to the given comparator. If the values compare
+ * as equal, the first is returned.
+ *
+ * The recommended solution for finding the {@code maximum} of some values depends on the type
+ * of your data and the number of elements you have. Read more in the Guava User Guide article on
+ * {@code
+ * Comparators}.
+ *
+ * @param a first value to compare, returned if greater than or equal to b.
+ * @param b second value to compare.
+ * @throws ClassCastException if the parameters are not mutually comparable using the given
+ * comparator.
+ * @since 30.0
+ */
+ @Beta
+ public static T max(T a, T b, Comparator comparator) {
+ return (comparator.compare(a, b) >= 0) ? a : b;
+ }
}
diff --git a/src/main/java/com/google/common/collect/ContiguousSet.java b/src/main/java/com/google/common/collect/ContiguousSet.java
index 6755be6..d471d09 100644
--- a/src/main/java/com/google/common/collect/ContiguousSet.java
+++ b/src/main/java/com/google/common/collect/ContiguousSet.java
@@ -191,15 +191,14 @@ public abstract class ContiguousSet extends ImmutableSorte
/*
* These methods perform most headSet, subSet, and tailSet logic, besides parameter validation.
*/
- // TODO(kevinb): we can probably make these real @Overrides now
- /* @Override */
+ @SuppressWarnings("MissingOverride") // Supermethod does not exist under GWT.
abstract ContiguousSet headSetImpl(C toElement, boolean inclusive);
- /* @Override */
+ @SuppressWarnings("MissingOverride") // Supermethod does not exist under GWT.
abstract ContiguousSet subSetImpl(
C fromElement, boolean fromInclusive, C toElement, boolean toInclusive);
- /* @Override */
+ @SuppressWarnings("MissingOverride") // Supermethod does not exist under GWT.
abstract ContiguousSet tailSetImpl(C fromElement, boolean inclusive);
/**
diff --git a/src/main/java/com/google/common/collect/FluentIterable.java b/src/main/java/com/google/common/collect/FluentIterable.java
index 6ee1ebd..f47528d 100644
--- a/src/main/java/com/google/common/collect/FluentIterable.java
+++ b/src/main/java/com/google/common/collect/FluentIterable.java
@@ -786,7 +786,7 @@ public abstract class FluentIterable implements Iterable {
checkNotNull(collection);
Iterable iterable = getDelegate();
if (iterable instanceof Collection) {
- collection.addAll(Collections2.cast(iterable));
+ collection.addAll((Collection) iterable);
} else {
for (E item : iterable) {
collection.add(item);
diff --git a/src/main/java/com/google/common/collect/ForwardingMap.java b/src/main/java/com/google/common/collect/ForwardingMap.java
index bdb9f0f..f6dc7b7 100644
--- a/src/main/java/com/google/common/collect/ForwardingMap.java
+++ b/src/main/java/com/google/common/collect/ForwardingMap.java
@@ -76,8 +76,8 @@ public abstract class ForwardingMap extends ForwardingObject implements Ma
@Override
- public V remove(Object object) {
- return delegate().remove(object);
+ public V remove(Object key) {
+ return delegate().remove(key);
}
@Override
diff --git a/src/main/java/com/google/common/collect/ImmutableBiMap.java b/src/main/java/com/google/common/collect/ImmutableBiMap.java
index 67670c5..9c0f6a2 100644
--- a/src/main/java/com/google/common/collect/ImmutableBiMap.java
+++ b/src/main/java/com/google/common/collect/ImmutableBiMap.java
@@ -413,15 +413,14 @@ public abstract class ImmutableBiMap extends ImmutableBiMapFauxverideShim<
* Since the bimap is immutable, ImmutableBiMap doesn't require special logic for keeping the
* bimap and its inverse in sync during serialization, the way AbstractBiMap does.
*/
- private static class SerializedForm extends ImmutableMap.SerializedForm {
- SerializedForm(ImmutableBiMap, ?> bimap) {
+ private static class SerializedForm extends ImmutableMap.SerializedForm {
+ SerializedForm(ImmutableBiMap bimap) {
super(bimap);
}
@Override
- Object readResolve() {
- Builder