java comparator comparing objects of objects code example Example: how to compare objects in java this.equals(other)