Skip to content

Commit 736eb9e

Browse files
committed
Fix adding an incorrectly added function
1 parent 972951a commit 736eb9e

File tree

1 file changed

+30
-19
lines changed
  • spring-batch-infrastructure/src/main/java/org/springframework/batch/item

1 file changed

+30
-19
lines changed

spring-batch-infrastructure/src/main/java/org/springframework/batch/item/Chunk.java

+30-19
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,36 @@ public String toString() {
211211
return String.format("[items=%s, skips=%s]", items, skips);
212212
}
213213

214+
@Override
215+
public boolean equals(Object obj) {
216+
if (obj == this) {
217+
return true;
218+
}
219+
if (!(obj instanceof Chunk)) {
220+
return false;
221+
}
222+
Chunk<?> other = (Chunk<?>) obj;
223+
return Objects.equals(this.items, other.items) &&
224+
Objects.equals(this.skips, other.skips) &&
225+
Objects.equals(this.errors, other.errors) &&
226+
Objects.equals(this.userData, other.userData) &&
227+
this.end == other.end &&
228+
this.busy == other.busy;
229+
}
230+
231+
@Override
232+
public int hashCode() {
233+
int result = 17;
234+
result = 31 * result + items.hashCode();
235+
result = 31 * result + skips.hashCode();
236+
result = 31 * result + errors.hashCode();
237+
result = 31 * result + Objects.hashCode(userData);
238+
result = 31 * result + (end ? 1 : 0);
239+
result = 31 * result + (busy ? 1 : 0);
240+
return result;
241+
}
242+
243+
214244
/**
215245
* Special iterator for a chunk providing the {@link #remove(Throwable)} method for
216246
* dynamically removing an item and adding it to the skips.
@@ -262,25 +292,6 @@ public String toString() {
262292
return String.format("[items=%s, skips=%s]", items, skips);
263293
}
264294

265-
@Override
266-
public int hashCode() {
267-
return Objects.hash(items, skips, errors, userData, end, busy);
268-
}
269-
270-
@Override
271-
public boolean equals(Object obj) {
272-
if (this == obj) {
273-
return true;
274-
}
275-
if (!(obj instanceof Chunk)) {
276-
return false;
277-
}
278-
Chunk<?> other = (Chunk<?>) obj;
279-
return Objects.equals(items, other.items) && Objects.equals(skips, other.skips)
280-
&& Objects.equals(errors, other.errors) && Objects.equals(userData, other.userData)
281-
&& end == other.end && busy == other.busy;
282-
}
283-
284295
}
285296

286297
}

0 commit comments

Comments
 (0)