Skip to content

New extension for -XObjectsHash #637

Open
@mattrpav

Description

@mattrpav
  1. Use Objects.hash for generating simple, dependency-free, hash codes for generated objects.
  2. Include unit test for all-primitive types, including arrays of primitives
  3. Include unit test for object containing another generated object as a child object.
import java.util.Objects;

public class Employee {
    private String name;
    private int id;
    private double salary;

    public Employee(String name, int id, double salary) {
        this.name = name;
        this.id = id;
        this.salary = salary;
    }

    @Override
    public int hashCode() {
        return Objects.hash(name, id, salary);
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions