File tree Expand file tree Collapse file tree 3 files changed +5
-37
lines changed
src/main/java/com/github/difflib Expand file tree Collapse file tree 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 {
6363
6464 @ Override
6565 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 );
7167 }
7268
7369 @ Override
Original file line number Diff line number Diff line change 2121
2222import java .util .Arrays ;
2323import java .util .List ;
24+ import java .util .Objects ;
2425
2526/**
2627 * Holds the information about the part of text involved in the diff process
@@ -108,26 +109,11 @@ public int last() {
108109 return getPosition () + size () - 1 ;
109110 }
110111
111- /*
112- * (non-Javadoc)
113- *
114- * @see java.lang.Object#hashCode()
115- */
116112 @ Override
117113 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 ());
124115 }
125116
126- /*
127- * (non-Javadoc)
128- *
129- * @see java.lang.Object#equals(java.lang.Object)
130- */
131117 @ Override
132118 public boolean equals (Object obj ) {
133119 if (this == obj ) {
Original file line number Diff line number Diff line change 2020package com .github .difflib .text ;
2121
2222import java .io .Serializable ;
23+ import java .util .Objects ;
2324
2425/**
2526 * Describes the diff row in form [tag, oldLine, newLine) for showing the difference between two texts
@@ -70,26 +71,11 @@ public String getNewLine() {
7071 return newLine ;
7172 }
7273
73- /*
74- * (non-Javadoc)
75- *
76- * @see java.lang.Object#hashCode()
77- */
7874 @ Override
7975 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 );
8677 }
8778
88- /*
89- * (non-Javadoc)
90- *
91- * @see java.lang.Object#equals(java.lang.Object)
92- */
9379 @ Override
9480 public boolean equals (Object obj ) {
9581 if (this == obj ) {
You can’t perform that action at this time.
0 commit comments