Skip to content

Commit 996bae5

Browse files
committed
Remove hashCode and equals from base class, support null default value
1 parent 71cd868 commit 996bae5

1 file changed

Lines changed: 1 addition & 18 deletions

File tree

gcloud-java-core/src/main/java/com/google/cloud/WaitForOption.java

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
package com.google.cloud;
1818

19-
import static com.google.common.base.MoreObjects.firstNonNull;
2019
import static com.google.common.base.Preconditions.checkArgument;
2120

2221
import com.google.common.base.MoreObjects;
@@ -185,26 +184,10 @@ final boolean baseEquals(WaitForOption option) {
185184
return Objects.equals(option.optionType, option.optionType);
186185
}
187186

188-
@Override
189-
public boolean equals(Object obj) {
190-
if (obj == this) {
191-
return true;
192-
}
193-
if (obj == null || !(obj.getClass().equals(WaitForOption.class))) {
194-
return false;
195-
}
196-
return baseEquals((WaitForOption) obj);
197-
}
198-
199187
final int baseHashCode() {
200188
return Objects.hash(optionType);
201189
}
202190

203-
@Override
204-
public int hashCode() {
205-
return baseHashCode();
206-
}
207-
208191
@SuppressWarnings("unchecked")
209192
private static <T extends WaitForOption> T getOrDefaultInternal(OptionType optionType,
210193
T defaultValue, WaitForOption... options) {
@@ -215,7 +198,7 @@ private static <T extends WaitForOption> T getOrDefaultInternal(OptionType optio
215198
foundOption = (T) option;
216199
}
217200
}
218-
return firstNonNull(foundOption, defaultValue);
201+
return foundOption != null ? foundOption : defaultValue;
219202
}
220203

221204
/**

0 commit comments

Comments
 (0)