One of the JavaIdioms, “Double Brace Initialization”

Objects created by DoubleBraceInitialization will never be equal to objects created without it. So you would never use this for any class that needs a nontrivial equals(Object)method.

public class DoubleBraceInitialization {
    
    private String str;

    public DoubleBraceInitialization() {
        str = "double brace initialization";
    }
    
    /**
     * @return the str
     */
    public String getStr() {
        return str;
    }

    /**
     * @param str the str to set
     */
    public void setStr(String str) {
        this.str = str;
    }

    /* (non-Javadoc)
     * @see java.lang.Object#hashCode()
     */
    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((str == null) ? 0 : str.hashCode());
        return result;
    }
    /* (non-Javadoc)
     * @see java.lang.Object#equals(java.lang.Object)
     */
    @Override
    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            System.out.print("Because " + this.getClass().getName() + "is different from " + obj.getClass().getName() + " , so answer is ");
            return false;
        }
        DoubleBraceInitialization other = (DoubleBraceInitialization) obj;
        if (str == null) {
            if (other.str != null) {
                return false;
            }
        } else if (!str.equals(other.str)) {
            System.out.print("Because str in " + this.getClass().getName() + "is different from " + obj.getClass().getName() + "'s, so answer is ");
            return false;
        }
        return true;
    }

    public static void main(String[] args) {
        DoubleBraceInitialization dbi1 = new DoubleBraceInitialization() {{
                this.setStr("double brace initialization");
        }};
        DoubleBraceInitialization dbi2 = new DoubleBraceInitialization();
        
        System.out.println("dbi1 vs dbi2 : " + dbi1.equals(dbi2));
    }
}

Standard out print:
Because DoubleBraceInitialization$1is different from DoubleBraceInitialization , so answer is dbi1 vs dbi2 : false

References:http://www.c2.com/cgi/wiki?DoubleBraceInitialization