I remember eclipse and idea have this template to automatically create an object\'s hashCode based on its attributes.
One of the strategies if a number and a string is u
Or, if you don't want to add another library, do something like the following:
public int hashCode() { StringBuilder builder = new StringBuilder(); builder.append(myString); builder.append(myInteger); return builder.toString().hashCode(); }