Skip to content

Commit fc671d8

Browse files
committed
Update hashCode and equals methods of some line-processing related classes.
DEVSIX-1827
1 parent 9379a19 commit fc671d8

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

io/src/main/java/com/itextpdf/io/font/otf/GlyphLine.java

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,25 @@ public boolean equals(Object obj) {
378378
return true;
379379
}
380380

381+
@Override
382+
public int hashCode() {
383+
int result = 0;
384+
result = 31*result + start;
385+
result = 31*result + end;
386+
for (int i = start; i < end; i++) {
387+
result = 31*result + glyphs.get(i).hashCode();
388+
}
389+
if (null != actualText) {
390+
for (int i = start; i < end; i++) {
391+
result = 31*result;
392+
if (null != actualText.get(i)) {
393+
result += actualText.get(i).hashCode();
394+
}
395+
}
396+
}
397+
return result;
398+
}
399+
381400
private void removeGlyph(int index) {
382401
glyphs.remove(index);
383402
if (actualText != null) {
@@ -440,5 +459,10 @@ public boolean equals(Object obj) {
440459
ActualText other = (ActualText) obj;
441460
return value == null && other.value == null || value.equals(other.value);
442461
}
462+
463+
@Override
464+
public int hashCode() {
465+
return 31*value.hashCode();
466+
}
443467
}
444468
}

0 commit comments

Comments
 (0)