File tree Expand file tree Collapse file tree
src/com/google/common/geometry Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -55,7 +55,6 @@ public int compareTo(ParametrizedS2Point o) {
5555 return point .compareTo (o .point );
5656 }
5757
58- @ SuppressWarnings ("EqualsHashCode" )
5958 @ Override
6059 public boolean equals (Object other ) {
6160 if (other instanceof ParametrizedS2Point ) {
@@ -65,4 +64,11 @@ public boolean equals(Object other) {
6564 return false ;
6665 }
6766 }
67+
68+ @ Override
69+ public int hashCode () {
70+ // TODO(jrosenstock): Use Objects.hash when API 19 (2014-06) is allowed. Current min is 14
71+ // (2011-10). Double.hashCode requires an even higher API level, so just hash the point.
72+ return point .hashCode ();
73+ }
6874}
Original file line number Diff line number Diff line change @@ -99,12 +99,16 @@ public boolean mayIntersect(S2Cell cell) {
9999 * NOTE: This should be rewritten to disregard order if such functionality is ever required.
100100 */
101101 @ Override
102- @ SuppressWarnings ("EqualsHashCode" )
103102 public boolean equals (Object thatObject ) {
104103 if (!(thatObject instanceof S2RegionIntersection )) {
105104 return false ;
106105 }
107106 S2RegionIntersection that = (S2RegionIntersection ) thatObject ;
108107 return Arrays .deepEquals (regions , that .regions );
109108 }
109+
110+ @ Override
111+ public int hashCode () {
112+ return Arrays .hashCode (regions );
113+ }
110114}
Original file line number Diff line number Diff line change @@ -104,12 +104,16 @@ public boolean mayIntersect(S2Cell cell) {
104104 * should be rewritten to disregard order if such functionality is ever required.
105105 */
106106 @ Override
107- @ SuppressWarnings ("EqualsHashCode" )
108107 public boolean equals (Object thatObject ) {
109108 if (!(thatObject instanceof S2RegionUnion )) {
110109 return false ;
111110 }
112111 S2RegionUnion that = (S2RegionUnion ) thatObject ;
113112 return Arrays .deepEquals (regions , that .regions );
114113 }
114+
115+ @ Override
116+ public int hashCode () {
117+ return Arrays .hashCode (regions );
118+ }
115119}
You can’t perform that action at this time.
0 commit comments