File tree 3 files changed +5
-37
lines changed
src/main/java/com/github/difflib
3 files changed +5
-37
lines changed Original file line number Diff line number Diff line change @@ -63,11 +63,7 @@ protected void verifyChunk(List<T> target) throws PatchFailedException {
63
63
64
64
@ Override
65
65
public int hashCode () {
66
- int hash = 3 ;
67
- hash = 61 * hash + Objects .hashCode (this .source );
68
- hash = 61 * hash + Objects .hashCode (this .target );
69
- hash = 61 * hash + Objects .hashCode (this .type );
70
- return hash ;
66
+ return Objects .hash (this .source , this .target , this .type );
71
67
}
72
68
73
69
@ Override
Original file line number Diff line number Diff line change 21
21
22
22
import java .util .Arrays ;
23
23
import java .util .List ;
24
+ import java .util .Objects ;
24
25
25
26
/**
26
27
* Holds the information about the part of text involved in the diff process
@@ -108,26 +109,11 @@ public int last() {
108
109
return getPosition () + size () - 1 ;
109
110
}
110
111
111
- /*
112
- * (non-Javadoc)
113
- *
114
- * @see java.lang.Object#hashCode()
115
- */
116
112
@ Override
117
113
public int hashCode () {
118
- final int prime = 31 ;
119
- int result = 1 ;
120
- result = prime * result + ((lines == null ) ? 0 : lines .hashCode ());
121
- result = prime * result + position ;
122
- result = prime * result + size ();
123
- return result ;
114
+ return Objects .hash (lines , position , size ());
124
115
}
125
116
126
- /*
127
- * (non-Javadoc)
128
- *
129
- * @see java.lang.Object#equals(java.lang.Object)
130
- */
131
117
@ Override
132
118
public boolean equals (Object obj ) {
133
119
if (this == obj ) {
Original file line number Diff line number Diff line change 20
20
package com .github .difflib .text ;
21
21
22
22
import java .io .Serializable ;
23
+ import java .util .Objects ;
23
24
24
25
/**
25
26
* Describes the diff row in form [tag, oldLine, newLine) for showing the difference between two texts
@@ -70,26 +71,11 @@ public String getNewLine() {
70
71
return newLine ;
71
72
}
72
73
73
- /*
74
- * (non-Javadoc)
75
- *
76
- * @see java.lang.Object#hashCode()
77
- */
78
74
@ Override
79
75
public int hashCode () {
80
- final int prime = 31 ;
81
- int result = 1 ;
82
- result = prime * result + ((newLine == null ) ? 0 : newLine .hashCode ());
83
- result = prime * result + ((oldLine == null ) ? 0 : oldLine .hashCode ());
84
- result = prime * result + ((tag == null ) ? 0 : tag .hashCode ());
85
- return result ;
76
+ return Objects .hash (newLine , oldLine , tag );
86
77
}
87
78
88
- /*
89
- * (non-Javadoc)
90
- *
91
- * @see java.lang.Object#equals(java.lang.Object)
92
- */
93
79
@ Override
94
80
public boolean equals (Object obj ) {
95
81
if (this == obj ) {
You can’t perform that action at this time.
0 commit comments