Use Lombok for equals() and hashCode() methods in KeyframeSet
This commit is contained in:
@@ -1,13 +1,15 @@
|
|||||||
package eu.crushedpixel.replaymod.holders;
|
package eu.crushedpixel.replaymod.holders;
|
||||||
|
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import org.apache.commons.lang3.builder.HashCodeBuilder;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
|
|
||||||
|
@EqualsAndHashCode
|
||||||
public class KeyframeSet implements GuiEntryListEntry {
|
public class KeyframeSet implements GuiEntryListEntry {
|
||||||
private String name;
|
private String name;
|
||||||
private Keyframe<AdvancedPosition>[] positionKeyframes;
|
private Keyframe<AdvancedPosition>[] positionKeyframes;
|
||||||
@@ -75,19 +77,4 @@ public class KeyframeSet implements GuiEntryListEntry {
|
|||||||
public String getDisplayString() {
|
public String getDisplayString() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object o2) {
|
|
||||||
if(o2 == null) return false;
|
|
||||||
if(!(o2 instanceof KeyframeSet)) return false;
|
|
||||||
KeyframeSet set2 = (KeyframeSet)o2;
|
|
||||||
return hashCode() == set2.hashCode();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
return new HashCodeBuilder(17, 37)
|
|
||||||
.append(getKeyframes())
|
|
||||||
.toHashCode();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user