From 5e32bb5d5a0e75475c9f42035081c4f8efb3cd4f Mon Sep 17 00:00:00 2001 From: Google Java Core Libraries Date: Mon, 29 Jan 2024 17:04:43 -0800 Subject: [PATCH] Internal change RELNOTES=n/a PiperOrigin-RevId: 602542725 --- .../src/com/google/common/collect/MoreCollectors.java | 10 +++++----- .../src/com/google/common/collect/MoreCollectors.java | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/android/guava/src/com/google/common/collect/MoreCollectors.java b/android/guava/src/com/google/common/collect/MoreCollectors.java index 02b254d2d54c..f010eea73b5e 100644 --- a/android/guava/src/com/google/common/collect/MoreCollectors.java +++ b/android/guava/src/com/google/common/collect/MoreCollectors.java @@ -103,7 +103,7 @@ private static final class ToOptionalState { extras = emptyList(); } - IllegalArgumentException multiples(boolean overflow) { + void multiples(boolean overflow) { StringBuilder sb = new StringBuilder().append("expected one element but was: <").append(element); for (Object o : extras) { @@ -127,7 +127,7 @@ void add(Object o) { } else if (extras.size() < MAX_EXTRAS) { extras.add(o); } else { - throw multiples(true); + multiples(true); } } @@ -145,7 +145,7 @@ ToOptionalState combine(ToOptionalState other) { extras.addAll(other.extras); if (extras.size() > MAX_EXTRAS) { extras.subList(MAX_EXTRAS, extras.size()).clear(); - throw multiples(true); + multiples(true); } return this; } @@ -156,7 +156,7 @@ Optional getOptional() { if (extras.isEmpty()) { return Optional.ofNullable(element); } else { - throw multiples(false); + multiples(false); } } @@ -166,7 +166,7 @@ Object getElement() { } else if (extras.isEmpty()) { return element; } else { - throw multiples(false); + multiples(false); } } } diff --git a/guava/src/com/google/common/collect/MoreCollectors.java b/guava/src/com/google/common/collect/MoreCollectors.java index 3c57ea0a9388..027fc7ff8c89 100644 --- a/guava/src/com/google/common/collect/MoreCollectors.java +++ b/guava/src/com/google/common/collect/MoreCollectors.java @@ -102,7 +102,7 @@ private static final class ToOptionalState { extras = emptyList(); } - IllegalArgumentException multiples(boolean overflow) { + void multiples(boolean overflow) { StringBuilder sb = new StringBuilder().append("expected one element but was: <").append(element); for (Object o : extras) { @@ -126,7 +126,7 @@ void add(Object o) { } else if (extras.size() < MAX_EXTRAS) { extras.add(o); } else { - throw multiples(true); + multiples(true); } } @@ -144,7 +144,7 @@ ToOptionalState combine(ToOptionalState other) { extras.addAll(other.extras); if (extras.size() > MAX_EXTRAS) { extras.subList(MAX_EXTRAS, extras.size()).clear(); - throw multiples(true); + multiples(true); } return this; } @@ -154,7 +154,7 @@ Optional getOptional() { if (extras.isEmpty()) { return Optional.ofNullable(element); } else { - throw multiples(false); + multiples(false); } } @@ -164,7 +164,7 @@ Object getElement() { } else if (extras.isEmpty()) { return element; } else { - throw multiples(false); + multiples(false); } } }