src/main/java/de/uniks/networkparser/list/AbstractList.java
AbstractList
has 22 methods (exceeds 20 allowed). Consider refactoring. Open
Open
public abstract class AbstractList<V> extends AbstractArray<V> implements Iterable<V>, Cloneable {
private Class<?> type;
@SuppressWarnings("unchecked")
public <ST extends AbstractList<V>> ST withType(Class<?> type) {
Ensure you override both equals() and hashCode() Open
Open
public boolean equals(Object obj) {
- Read upRead up
- Exclude checks
OverrideBothEqualsAndHashcode
Since: PMD 0.4
Priority: Medium
Categories: Style
Remediation Points: 50000
Override both public boolean Object.equals(Object other), and public int Object.hashCode(), or override neither. Even if you are inheriting a hashCode() from a parent class, consider implementing hashCode and explicitly delegating to your superclass.
Example:
public class Bar { // poor, missing a hashcode() method
public boolean equals(Object o) {
// do some comparison
}
}
public class Baz { // poor, missing an equals() method
public int hashCode() {
// return some hash value
}
}
public class Foo { // perfect, both methods provided
public boolean equals(Object other) {
// do some comparison
}
public int hashCode() {
// return some hash value
}
}