Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Internal change #6951

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions android/guava/src/com/google/common/collect/MoreCollectors.java
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -127,7 +127,7 @@ void add(Object o) {
} else if (extras.size() < MAX_EXTRAS) {
extras.add(o);
} else {
throw multiples(true);
multiples(true);
}
}

Expand All @@ -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;
}
Expand All @@ -156,7 +156,7 @@ Optional<Object> getOptional() {
if (extras.isEmpty()) {
return Optional.ofNullable(element);
} else {
throw multiples(false);
multiples(false);
}
}

Expand All @@ -166,7 +166,7 @@ Object getElement() {
} else if (extras.isEmpty()) {
return element;
} else {
throw multiples(false);
multiples(false);
}
}
}
Expand Down
10 changes: 5 additions & 5 deletions guava/src/com/google/common/collect/MoreCollectors.java
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -126,7 +126,7 @@ void add(Object o) {
} else if (extras.size() < MAX_EXTRAS) {
extras.add(o);
} else {
throw multiples(true);
multiples(true);
}
}

Expand All @@ -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;
}
Expand All @@ -154,7 +154,7 @@ Optional<Object> getOptional() {
if (extras.isEmpty()) {
return Optional.ofNullable(element);
} else {
throw multiples(false);
multiples(false);
}
}

Expand All @@ -164,7 +164,7 @@ Object getElement() {
} else if (extras.isEmpty()) {
return element;
} else {
throw multiples(false);
multiples(false);
}
}
}
Expand Down
Loading