From b9b6084dff44ced77e6ee3162c3bdcd533a9f601 Mon Sep 17 00:00:00 2001 From: cpovirk Date: Tue, 7 May 2024 19:58:47 -0700 Subject: [PATCH] Standardize parameter names across `Immutable*.of(...)` methods. This increases the chances that they will be sorted from fewest args to most args. It also matches what we already do for the `of` methods of key-value collections like `ImmutableMap`. RELNOTES=n/a PiperOrigin-RevId: 631629370 --- .../guava/src/com/google/common/collect/ImmutableList.java | 6 +++--- .../src/com/google/common/collect/ImmutableMultiset.java | 6 +++--- .../guava/src/com/google/common/collect/ImmutableSet.java | 6 +++--- .../com/google/common/collect/ImmutableSortedMultiset.java | 6 +++--- .../src/com/google/common/collect/ImmutableSortedSet.java | 6 +++--- .../super/com/google/common/collect/ImmutableList.java | 4 ++-- .../super/com/google/common/collect/ImmutableSet.java | 4 ++-- .../super/com/google/common/collect/ImmutableSortedSet.java | 4 ++-- guava/src/com/google/common/collect/ImmutableList.java | 6 +++--- guava/src/com/google/common/collect/ImmutableMultiset.java | 6 +++--- guava/src/com/google/common/collect/ImmutableSet.java | 6 +++--- .../com/google/common/collect/ImmutableSortedMultiset.java | 6 +++--- guava/src/com/google/common/collect/ImmutableSortedSet.java | 6 +++--- 13 files changed, 36 insertions(+), 36 deletions(-) diff --git a/android/guava/src/com/google/common/collect/ImmutableList.java b/android/guava/src/com/google/common/collect/ImmutableList.java index 2f760de17cb8..197e0c046266 100644 --- a/android/guava/src/com/google/common/collect/ImmutableList.java +++ b/android/guava/src/com/google/common/collect/ImmutableList.java @@ -95,10 +95,10 @@ public static ImmutableList of() { * comparably to {@link Collections#singletonList}, but will not accept a null element. It is * preferable mainly for consistency and maintainability of your code. * - * @throws NullPointerException if {@code element} is null + * @throws NullPointerException if the element is null */ - public static ImmutableList of(E element) { - return construct(element); + public static ImmutableList of(E e1) { + return construct(e1); } /** diff --git a/android/guava/src/com/google/common/collect/ImmutableMultiset.java b/android/guava/src/com/google/common/collect/ImmutableMultiset.java index 493cfb70a587..f5d06865775d 100644 --- a/android/guava/src/com/google/common/collect/ImmutableMultiset.java +++ b/android/guava/src/com/google/common/collect/ImmutableMultiset.java @@ -109,11 +109,11 @@ public static ImmutableMultiset of() { /** * Returns an immutable multiset containing a single element. * - * @throws NullPointerException if {@code element} is null + * @throws NullPointerException if the element is null * @since 6.0 (source-compatible since 2.0) */ - public static ImmutableMultiset of(E element) { - return copyFromElements(element); + public static ImmutableMultiset of(E e1) { + return copyFromElements(e1); } /** diff --git a/android/guava/src/com/google/common/collect/ImmutableSet.java b/android/guava/src/com/google/common/collect/ImmutableSet.java index 9e6c120a71e3..f85ef54bfe31 100644 --- a/android/guava/src/com/google/common/collect/ImmutableSet.java +++ b/android/guava/src/com/google/common/collect/ImmutableSet.java @@ -81,12 +81,12 @@ public static ImmutableSet of() { } /** - * Returns an immutable set containing {@code element}. Preferred over {@link + * Returns an immutable set containing the given element. Preferred over {@link * Collections#singleton} for code consistency, {@code null} rejection, and because the return * type conveys the immutability guarantee. */ - public static ImmutableSet of(E element) { - return new SingletonImmutableSet<>(element); + public static ImmutableSet of(E e1) { + return new SingletonImmutableSet<>(e1); } /** diff --git a/android/guava/src/com/google/common/collect/ImmutableSortedMultiset.java b/android/guava/src/com/google/common/collect/ImmutableSortedMultiset.java index 33430f491963..03da1a982889 100644 --- a/android/guava/src/com/google/common/collect/ImmutableSortedMultiset.java +++ b/android/guava/src/com/google/common/collect/ImmutableSortedMultiset.java @@ -140,9 +140,9 @@ public static ImmutableSortedMultiset of() { } /** Returns an immutable sorted multiset containing a single element. */ - public static > ImmutableSortedMultiset of(E element) { + public static > ImmutableSortedMultiset of(E e1) { RegularImmutableSortedSet elementSet = - (RegularImmutableSortedSet) ImmutableSortedSet.of(element); + (RegularImmutableSortedSet) ImmutableSortedSet.of(e1); long[] cumulativeCounts = {0, 1}; return new RegularImmutableSortedMultiset<>(elementSet, cumulativeCounts, 0, 1); } @@ -817,7 +817,7 @@ public static ImmutableSortedMultiset.Builder builder() { */ @DoNotCall("Elements must be Comparable. (Or, pass a Comparator to orderedBy or copyOf.)") @Deprecated - public static ImmutableSortedMultiset of(E element) { + public static ImmutableSortedMultiset of(E e1) { 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 0f61c768c5c2..6cdcf22c244c 100644 --- a/android/guava/src/com/google/common/collect/ImmutableSortedSet.java +++ b/android/guava/src/com/google/common/collect/ImmutableSortedSet.java @@ -103,8 +103,8 @@ public static ImmutableSortedSet of() { } /** Returns an immutable sorted set containing a single element. */ - public static > ImmutableSortedSet of(E element) { - return new RegularImmutableSortedSet<>(ImmutableList.of(element), Ordering.natural()); + public static > ImmutableSortedSet of(E e1) { + return new RegularImmutableSortedSet<>(ImmutableList.of(e1), Ordering.natural()); } /** @@ -845,7 +845,7 @@ public static ImmutableSortedSet.Builder builderWithExpectedSize(int expe */ @DoNotCall("Pass a parameter of type Comparable") @Deprecated - public static ImmutableSortedSet of(E element) { + public static ImmutableSortedSet of(E e1) { throw new UnsupportedOperationException(); } diff --git a/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/ImmutableList.java b/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/ImmutableList.java index 12e6041b0fbd..a409e2e12033 100644 --- a/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/ImmutableList.java +++ b/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/ImmutableList.java @@ -54,8 +54,8 @@ public static ImmutableList of() { return (ImmutableList) RegularImmutableList.EMPTY; } - public static ImmutableList of(E element) { - return new SingletonImmutableList(checkNotNull(element)); + public static ImmutableList of(E e1) { + return new SingletonImmutableList(checkNotNull(e1)); } public static ImmutableList of(E e1, E e2) { diff --git a/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/ImmutableSet.java b/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/ImmutableSet.java index 603fc1766955..6fd8ee8de0ae 100644 --- a/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/ImmutableSet.java +++ b/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/ImmutableSet.java @@ -55,8 +55,8 @@ public static ImmutableSet of() { return (ImmutableSet) RegularImmutableSet.EMPTY; } - public static ImmutableSet of(E element) { - return new SingletonImmutableSet(element); + public static ImmutableSet of(E e1) { + return new SingletonImmutableSet(e1); } @SuppressWarnings("unchecked") diff --git a/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/ImmutableSortedSet.java b/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/ImmutableSortedSet.java index 2a486736380b..d0f0cc94582c 100644 --- a/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/ImmutableSortedSet.java +++ b/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/ImmutableSortedSet.java @@ -79,8 +79,8 @@ public static ImmutableSortedSet of() { return (ImmutableSortedSet) NATURAL_EMPTY_SET; } - public static > ImmutableSortedSet of(E element) { - return ofInternal(Ordering.natural(), element); + public static > ImmutableSortedSet of(E e1) { + return ofInternal(Ordering.natural(), e1); } @SuppressWarnings("unchecked") diff --git a/guava/src/com/google/common/collect/ImmutableList.java b/guava/src/com/google/common/collect/ImmutableList.java index 63f6de65477a..1a430dea9be3 100644 --- a/guava/src/com/google/common/collect/ImmutableList.java +++ b/guava/src/com/google/common/collect/ImmutableList.java @@ -95,10 +95,10 @@ public static ImmutableList of() { * comparably to {@link Collections#singletonList}, but will not accept a null element. It is * preferable mainly for consistency and maintainability of your code. * - * @throws NullPointerException if {@code element} is null + * @throws NullPointerException if the element is null */ - public static ImmutableList of(E element) { - return new SingletonImmutableList<>(element); + public static ImmutableList of(E e1) { + return new SingletonImmutableList<>(e1); } /** diff --git a/guava/src/com/google/common/collect/ImmutableMultiset.java b/guava/src/com/google/common/collect/ImmutableMultiset.java index ed5c5284410f..34951c5fb1c2 100644 --- a/guava/src/com/google/common/collect/ImmutableMultiset.java +++ b/guava/src/com/google/common/collect/ImmutableMultiset.java @@ -104,11 +104,11 @@ public static ImmutableMultiset of() { /** * Returns an immutable multiset containing a single element. * - * @throws NullPointerException if {@code element} is null + * @throws NullPointerException if the element is null * @since 6.0 (source-compatible since 2.0) */ - public static ImmutableMultiset of(E element) { - return copyFromElements(element); + public static ImmutableMultiset of(E e1) { + return copyFromElements(e1); } /** diff --git a/guava/src/com/google/common/collect/ImmutableSet.java b/guava/src/com/google/common/collect/ImmutableSet.java index 0e50546ff217..c7ed896cb317 100644 --- a/guava/src/com/google/common/collect/ImmutableSet.java +++ b/guava/src/com/google/common/collect/ImmutableSet.java @@ -84,12 +84,12 @@ public static ImmutableSet of() { } /** - * Returns an immutable set containing {@code element}. Preferred over {@link + * Returns an immutable set containing the given element. Preferred over {@link * Collections#singleton} for code consistency, {@code null} rejection, and because the return * type conveys the immutability guarantee. */ - public static ImmutableSet of(E element) { - return new SingletonImmutableSet<>(element); + public static ImmutableSet of(E e1) { + return new SingletonImmutableSet<>(e1); } /* diff --git a/guava/src/com/google/common/collect/ImmutableSortedMultiset.java b/guava/src/com/google/common/collect/ImmutableSortedMultiset.java index bdfad999d8d8..c68478b42897 100644 --- a/guava/src/com/google/common/collect/ImmutableSortedMultiset.java +++ b/guava/src/com/google/common/collect/ImmutableSortedMultiset.java @@ -114,9 +114,9 @@ public static ImmutableSortedMultiset of() { } /** Returns an immutable sorted multiset containing a single element. */ - public static > ImmutableSortedMultiset of(E element) { + public static > ImmutableSortedMultiset of(E e1) { RegularImmutableSortedSet elementSet = - (RegularImmutableSortedSet) ImmutableSortedSet.of(element); + (RegularImmutableSortedSet) ImmutableSortedSet.of(e1); long[] cumulativeCounts = {0, 1}; return new RegularImmutableSortedMultiset<>(elementSet, cumulativeCounts, 0, 1); } @@ -665,7 +665,7 @@ public static ImmutableSortedMultiset.Builder builder() { */ @DoNotCall("Elements must be Comparable. (Or, pass a Comparator to orderedBy or copyOf.)") @Deprecated - public static ImmutableSortedMultiset of(E element) { + public static ImmutableSortedMultiset of(E e1) { throw new UnsupportedOperationException(); } diff --git a/guava/src/com/google/common/collect/ImmutableSortedSet.java b/guava/src/com/google/common/collect/ImmutableSortedSet.java index f8fe43fb50f8..31ca5e202575 100644 --- a/guava/src/com/google/common/collect/ImmutableSortedSet.java +++ b/guava/src/com/google/common/collect/ImmutableSortedSet.java @@ -105,8 +105,8 @@ public static ImmutableSortedSet of() { } /** Returns an immutable sorted set containing a single element. */ - public static > ImmutableSortedSet of(E element) { - return new RegularImmutableSortedSet<>(ImmutableList.of(element), Ordering.natural()); + public static > ImmutableSortedSet of(E e1) { + return new RegularImmutableSortedSet<>(ImmutableList.of(e1), Ordering.natural()); } /** @@ -914,7 +914,7 @@ public static ImmutableSortedSet.Builder builderWithExpectedSize(int expe */ @DoNotCall("Pass a parameter of type Comparable") @Deprecated - public static ImmutableSortedSet of(E element) { + public static ImmutableSortedSet of(E e1) { throw new UnsupportedOperationException(); }