Guava equals, hashCode and toString generator

Compatible with: IntelliJ IDEA Android Studio
Apr 11, 2014
11 511
Generates equals and hashCode, as well as toString, utilising the Guava libraries
ALT+INSERT : equals & hashCode and toString options will be shown.

Given a class with the following fields:
private int field1;
private String field2;
private long field3;

The following methods would be generated:

public boolean equals(Object o) {
    if (this == o) return true;
    if (o == null || getClass() != o.getClass()) return false;

    TestHarness that = (TestHarness) o;

    return Objects.equal(this.field1, that.field1) &&
            Objects.equal(this.field2, that.field2) &&
            Objects.equal(this.field3, that.field3);

public int hashCode() {
    return Objects.hashCode(field1, field2, field3);

public String toString() {
    return Objects.toStringHelper(this)
            .add("field1", field1)
            .add("field2", field2)
            .add("field3", field3)

Download plugin