Check for Equality

To check if the components of a record match with another, you can use the equals method.

record Elf(boolean pretentious) {}
record Elf(boolean pretentious) {}
class Main {
    void main() {
        var elfOne = new Elf(true);
        var elfTwo = new Elf(true);
        
        System.out.println(elfOne.equals(elfTwo));
    }
}

This is similar to how you check whether Strings are equal.