diff options
author | Sadaf Ebrahimi <sadafebrahimi@google.com> | 2024-01-03 18:28:12 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2024-01-03 18:28:12 +0000 |
commit | 3a26b44cf26f6ce43348612f69209df5d367f2ba (patch) | |
tree | cbc7e4894708533a0ddc4e61da1d74e64393e0e1 /android/guava-tests/test/com/google/common/collect/Base.java | |
parent | 853ca10c27d5c306f314d4a498813393a65fd479 (diff) | |
parent | 422eb80feae2e73eda9678ecaacbd087d4b7020b (diff) | |
download | guava-3a26b44cf26f6ce43348612f69209df5d367f2ba.tar.gz |
Merge "Upgrade guava to v33.0.0" into main am: fcb6827395 am: 0be00b5218 am: 422eb80fea
Original change: https://android-review.googlesource.com/c/platform/external/guava/+/2894060
Change-Id: I9a7385b0f8af3ec832abe8b207a1c25e1d5dc9e5
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
Diffstat (limited to 'android/guava-tests/test/com/google/common/collect/Base.java')
-rw-r--r-- | android/guava-tests/test/com/google/common/collect/Base.java | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/android/guava-tests/test/com/google/common/collect/Base.java b/android/guava-tests/test/com/google/common/collect/Base.java new file mode 100644 index 000000000..b68bd7f65 --- /dev/null +++ b/android/guava-tests/test/com/google/common/collect/Base.java @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2007 The Guava Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.common.collect; + +import com.google.common.annotations.GwtCompatible; +import java.io.Serializable; +import org.checkerframework.checker.nullness.qual.Nullable; + +/** Simple base class to verify that we handle generics correctly. */ +@GwtCompatible +class Base implements Comparable<Base>, Serializable { + private final String s; + + public Base(String s) { + this.s = s; + } + + @Override + public int hashCode() { // delegate to 's' + return s.hashCode(); + } + + @Override + public boolean equals(@Nullable Object other) { + if (other == null) { + return false; + } else if (other instanceof Base) { + return s.equals(((Base) other).s); + } else { + return false; + } + } + + @Override + public int compareTo(Base o) { + return s.compareTo(o.s); + } + + private static final long serialVersionUID = 0; +} |