@Override
    public boolean equals(Object other){
        if(other == null){
            return false;
        } else if (this == other) {
            return true;
        } else if (!(other instanceof RecipeIngredient)) {
            return false;
        }

        //Numbers in prefix and suffix might be sql doubles so we should remove
        //their trailing zeros since they make no semantic difference.
        String ownPrefix = adjustUnitsInString(prefix, 1);
        String otherPrefix = adjustUnitsInString(((RecipeIngredient) other).getPrefix(), 1);
        String ownSuffix = adjustUnitsInString(suffix, 1);
        String otherSuffix = adjustUnitsInString(((RecipeIngredient) other).getSuffix(), 1);
        return ownPrefix.equals(otherPrefix) &&
                ownSuffix.equals((otherSuffix)) &&
                ingredient.equals(((RecipeIngredient) other).getIngredient());
    }