File tree Expand file tree Collapse file tree 2 files changed +9
-24
lines changed
src/test/java/org/apache/ibatis/submitted Expand file tree Collapse file tree 2 files changed +9
-24
lines changed Original file line number Diff line number Diff line change 1515 */
1616package org .apache .ibatis .submitted .constructor_columnprefix ;
1717
18+ import java .util .Objects ;
19+
1820public class EntityKey {
1921 private Integer id ;
2022
@@ -28,10 +30,7 @@ public void setId(Integer id) {
2830
2931 @ Override
3032 public int hashCode () {
31- final int prime = 31 ;
32- int result = 1 ;
33- result = prime * result + ((id == null ) ? 0 : id .hashCode ());
34- return result ;
33+ return Objects .hash (id );
3534 }
3635
3736 @ Override
@@ -43,11 +42,7 @@ public boolean equals(Object obj) {
4342 return false ;
4443 }
4544 EntityKey other = (EntityKey ) obj ;
46- if (id == null ) {
47- if (other .id != null ) {
48- return false ;
49- }
50- } else if (!id .equals (other .id )) {
45+ if (!Objects .equals (id , other .id )) {
5146 return false ;
5247 }
5348 return true ;
Original file line number Diff line number Diff line change 1515 */
1616package org .apache .ibatis .submitted .extendresultmap ;
1717
18+ import java .util .Objects ;
19+
1820public class TestModel {
1921
2022 private String a ;
@@ -46,11 +48,7 @@ public void setB(String b) {
4648
4749 @ Override
4850 public int hashCode () {
49- final int prime = 31 ;
50- int result = 1 ;
51- result = prime * result + ((a == null ) ? 0 : a .hashCode ());
52- result = prime * result + ((b == null ) ? 0 : b .hashCode ());
53- return result ;
51+ return Objects .hash (a , b );
5452 }
5553
5654 @ Override
@@ -62,18 +60,10 @@ public boolean equals(Object obj) {
6260 return false ;
6361 }
6462 TestModel other = (TestModel ) obj ;
65- if (a == null ) {
66- if (other .a != null ) {
67- return false ;
68- }
69- } else if (!a .equals (other .a )) {
63+ if (!Objects .equals (a , other .a )) {
7064 return false ;
7165 }
72- if (b == null ) {
73- if (other .b != null ) {
74- return false ;
75- }
76- } else if (!b .equals (other .b )) {
66+ if (!Objects .equals (b , other .b )) {
7767 return false ;
7868 }
7969 return true ;
You can’t perform that action at this time.
0 commit comments