| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
package com.google.common.collect.testing; |
| 18 |
|
| 19 |
import com.google.common.annotations.GwtCompatible; |
| 20 |
import java.io.Serializable; |
| 21 |
import org.checkerframework.checker.nullness.qual.Nullable; |
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
@GwtCompatible |
| 29 |
public class BaseComparable implements Comparable<BaseComparable>, Serializable { |
| 30 |
private final String s; |
| 31 |
|
| 32 |
public BaseComparable(String s) { |
| 33 |
this.s = s; |
| 34 |
} |
| 35 |
|
| 36 |
@Override |
| 37 |
public int hashCode() { |
| 38 |
return s.hashCode(); |
| 39 |
} |
| 40 |
|
| 41 |
@Override |
| 42 |
public boolean equals(@Nullable Object other) { |
| 43 |
if (other == null) { |
| 44 |
return false; |
| 45 |
} else if (other instanceof BaseComparable) { |
| 46 |
return s.equals(((BaseComparable) other).s); |
| 47 |
} else { |
| 48 |
return false; |
| 49 |
} |
| 50 |
} |
| 51 |
|
| 52 |
@Override |
| 53 |
public int compareTo(BaseComparable o) { |
| 54 |
return s.compareTo(o.s); |
| 55 |
} |
| 56 |
|
| 57 |
private static final long serialVersionUID = 0; |
| 58 |
} |