intellij generate getter code example

Example 1: generate getters and setters intellij

alt + insert // Select appropriately from dropdown menu

Example 2: how to generate equals and hashcode in intellij

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

        FixedRateCurrencyExchangeService that=(FixedRateCurrencyExchangeService)o;

        if(Double.compare(that.rate,rate)!=0)return false;

        return true;
        }

public int hashCode(){
        long temp=rate!=+0.0d?Double.doubleToLongBits(rate):0L;
        return int(temp^(temp>>>32));
        }

Tags:

Misc Example