diff options
author | cpovirk <cpovirk@google.com> | 2024-05-07 19:58:47 -0700 |
---|---|---|
committer | Google Java Core Libraries <jake-team+copybara@google.com> | 2024-05-07 20:01:02 -0700 |
commit | b9b6084dff44ced77e6ee3162c3bdcd533a9f601 (patch) | |
tree | 6dd695926ce08016b6bc54a133f971f448f256c7 | |
parent | 1b3969e80426027e546b2eec5ba4fd453fc58bbc (diff) | |
download | guava-b9b6084dff44ced77e6ee3162c3bdcd533a9f601.tar.gz |
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
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 2f760de17..197e0c046 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 abstract class ImmutableList<E> extends ImmutableCollection<E> * 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 <E> ImmutableList<E> of(E element) { - return construct(element); + public static <E> ImmutableList<E> 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 493cfb70a..f5d068657 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 abstract class ImmutableMultiset<E> extends ImmutableMultisetGwtSerializa /** * 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 <E> ImmutableMultiset<E> of(E element) { - return copyFromElements(element); + public static <E> ImmutableMultiset<E> 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 9e6c120a7..f85ef54bf 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 abstract class ImmutableSet<E> extends ImmutableCollection<E> implements } /** - * 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 <E> ImmutableSet<E> of(E element) { - return new SingletonImmutableSet<>(element); + public static <E> ImmutableSet<E> 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 33430f491..03da1a982 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 abstract class ImmutableSortedMultiset<E> extends ImmutableMultiset<E> } /** Returns an immutable sorted multiset containing a single element. */ - public static <E extends Comparable<? super E>> ImmutableSortedMultiset<E> of(E element) { + public static <E extends Comparable<? super E>> ImmutableSortedMultiset<E> of(E e1) { RegularImmutableSortedSet<E> elementSet = - (RegularImmutableSortedSet<E>) ImmutableSortedSet.of(element); + (RegularImmutableSortedSet<E>) ImmutableSortedSet.of(e1); long[] cumulativeCounts = {0, 1}; return new RegularImmutableSortedMultiset<>(elementSet, cumulativeCounts, 0, 1); } @@ -817,7 +817,7 @@ public abstract class ImmutableSortedMultiset<E> extends ImmutableMultiset<E> */ @DoNotCall("Elements must be Comparable. (Or, pass a Comparator to orderedBy or copyOf.)") @Deprecated - public static <E> ImmutableSortedMultiset<E> of(E element) { + public static <E> ImmutableSortedMultiset<E> 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 0f61c768c..6cdcf22c2 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 abstract class ImmutableSortedSet<E> extends ImmutableSet<E> } /** Returns an immutable sorted set containing a single element. */ - public static <E extends Comparable<? super E>> ImmutableSortedSet<E> of(E element) { - return new RegularImmutableSortedSet<>(ImmutableList.of(element), Ordering.natural()); + public static <E extends Comparable<? super E>> ImmutableSortedSet<E> of(E e1) { + return new RegularImmutableSortedSet<>(ImmutableList.of(e1), Ordering.natural()); } /** @@ -845,7 +845,7 @@ public abstract class ImmutableSortedSet<E> extends ImmutableSet<E> */ @DoNotCall("Pass a parameter of type Comparable") @Deprecated - public static <E> ImmutableSortedSet<E> of(E element) { + public static <E> ImmutableSortedSet<E> 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 12e6041b0..a409e2e12 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 abstract class ImmutableList<E> extends ImmutableCollection<E> return (ImmutableList<E>) RegularImmutableList.EMPTY; } - public static <E> ImmutableList<E> of(E element) { - return new SingletonImmutableList<E>(checkNotNull(element)); + public static <E> ImmutableList<E> of(E e1) { + return new SingletonImmutableList<E>(checkNotNull(e1)); } public static <E> ImmutableList<E> 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 603fc1766..6fd8ee8de 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 abstract class ImmutableSet<E> extends ImmutableCollection<E> implements return (ImmutableSet<E>) RegularImmutableSet.EMPTY; } - public static <E> ImmutableSet<E> of(E element) { - return new SingletonImmutableSet<E>(element); + public static <E> ImmutableSet<E> of(E e1) { + return new SingletonImmutableSet<E>(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 2a4867363..d0f0cc945 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 abstract class ImmutableSortedSet<E> extends ForwardingImmutableSet<E> return (ImmutableSortedSet<E>) NATURAL_EMPTY_SET; } - public static <E extends Comparable<? super E>> ImmutableSortedSet<E> of(E element) { - return ofInternal(Ordering.natural(), element); + public static <E extends Comparable<? super E>> ImmutableSortedSet<E> 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 63f6de654..1a430dea9 100644 --- a/guava/src/com/google/common/collect/ImmutableList.java +++ b/guava/src/com/google/common/collect/ImmutableList.java @@ -95,10 +95,10 @@ public abstract class ImmutableList<E> extends ImmutableCollection<E> * 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 <E> ImmutableList<E> of(E element) { - return new SingletonImmutableList<>(element); + public static <E> ImmutableList<E> 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 ed5c52844..34951c5fb 100644 --- a/guava/src/com/google/common/collect/ImmutableMultiset.java +++ b/guava/src/com/google/common/collect/ImmutableMultiset.java @@ -104,11 +104,11 @@ public abstract class ImmutableMultiset<E> extends ImmutableMultisetGwtSerializa /** * 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 <E> ImmutableMultiset<E> of(E element) { - return copyFromElements(element); + public static <E> ImmutableMultiset<E> 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 0e50546ff..c7ed896cb 100644 --- a/guava/src/com/google/common/collect/ImmutableSet.java +++ b/guava/src/com/google/common/collect/ImmutableSet.java @@ -84,12 +84,12 @@ public abstract class ImmutableSet<E> extends ImmutableCollection<E> implements } /** - * 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 <E> ImmutableSet<E> of(E element) { - return new SingletonImmutableSet<>(element); + public static <E> ImmutableSet<E> 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 bdfad999d..c68478b42 100644 --- a/guava/src/com/google/common/collect/ImmutableSortedMultiset.java +++ b/guava/src/com/google/common/collect/ImmutableSortedMultiset.java @@ -114,9 +114,9 @@ public abstract class ImmutableSortedMultiset<E> extends ImmutableMultiset<E> } /** Returns an immutable sorted multiset containing a single element. */ - public static <E extends Comparable<? super E>> ImmutableSortedMultiset<E> of(E element) { + public static <E extends Comparable<? super E>> ImmutableSortedMultiset<E> of(E e1) { RegularImmutableSortedSet<E> elementSet = - (RegularImmutableSortedSet<E>) ImmutableSortedSet.of(element); + (RegularImmutableSortedSet<E>) ImmutableSortedSet.of(e1); long[] cumulativeCounts = {0, 1}; return new RegularImmutableSortedMultiset<>(elementSet, cumulativeCounts, 0, 1); } @@ -665,7 +665,7 @@ public abstract class ImmutableSortedMultiset<E> extends ImmutableMultiset<E> */ @DoNotCall("Elements must be Comparable. (Or, pass a Comparator to orderedBy or copyOf.)") @Deprecated - public static <E> ImmutableSortedMultiset<E> of(E element) { + public static <E> ImmutableSortedMultiset<E> 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 f8fe43fb5..31ca5e202 100644 --- a/guava/src/com/google/common/collect/ImmutableSortedSet.java +++ b/guava/src/com/google/common/collect/ImmutableSortedSet.java @@ -105,8 +105,8 @@ public abstract class ImmutableSortedSet<E> extends ImmutableSet.CachingAsList<E } /** Returns an immutable sorted set containing a single element. */ - public static <E extends Comparable<? super E>> ImmutableSortedSet<E> of(E element) { - return new RegularImmutableSortedSet<>(ImmutableList.of(element), Ordering.natural()); + public static <E extends Comparable<? super E>> ImmutableSortedSet<E> of(E e1) { + return new RegularImmutableSortedSet<>(ImmutableList.of(e1), Ordering.natural()); } /** @@ -914,7 +914,7 @@ public abstract class ImmutableSortedSet<E> extends ImmutableSet.CachingAsList<E */ @DoNotCall("Pass a parameter of type Comparable") @Deprecated - public static <E> ImmutableSortedSet<E> of(E element) { + public static <E> ImmutableSortedSet<E> of(E e1) { throw new UnsupportedOperationException(); } |