@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((assignee == null) ? 0 : assignee.hashCode()); result = prime * result + ((author == null) ? 0 : author.hashCode()); result = prime * result + ((createdOn == null) ? 0 : createdOn.hashCode()); result = prime * result + ((customFields == null) ? 0 : customFields.hashCode()); result = prime * result + ((description == null) ? 0 : description.hashCode()); result = prime * result + ((doneRatio == null) ? 0 : doneRatio.hashCode()); result = prime * result + ((dueDate == null) ? 0 : dueDate.hashCode()); result = prime * result + ((estimatedHours == null) ? 0 : estimatedHours.hashCode()); result = prime * result + ((id == null) ? 0 : id.hashCode()); result = prime * result + ((journals == null) ? 0 : journals.hashCode()); result = prime * result + ((notes == null) ? 0 : notes.hashCode()); result = prime * result + ((parentId == null) ? 0 : parentId.hashCode()); result = prime * result + ((priorityId == null) ? 0 : priorityId.hashCode()); result = prime * result + ((priorityText == null) ? 0 : priorityText.hashCode()); result = prime * result + ((project == null) ? 0 : project.hashCode()); result = prime * result + ((relations == null) ? 0 : relations.hashCode()); result = prime * result + ((spentHours == null) ? 0 : spentHours.hashCode()); result = prime * result + ((startDate == null) ? 0 : startDate.hashCode()); result = prime * result + ((statusId == null) ? 0 : statusId.hashCode()); result = prime * result + ((statusName == null) ? 0 : statusName.hashCode()); result = prime * result + ((subject == null) ? 0 : subject.hashCode()); result = prime * result + ((tracker == null) ? 0 : tracker.hashCode()); result = prime * result + ((updatedOn == null) ? 0 : updatedOn.hashCode()); return result; }
public static void main(String[] args) { List<User> userArrayList = new ArrayList<User>(); userArrayList.add(new User("1", "First")); userArrayList.add(new User("2", "Second")); userArrayList.add(new User("3", "Third")); userArrayList.add(new User("1", "First")); List<User> userLinkedList = new LinkedList<User>(); userLinkedList.add(new User("1", "First")); userLinkedList.add(new User("2", "Second")); userLinkedList.add(new User("3", "Third")); userLinkedList.add(new User("1", "First")); Set<User> userHashSet = new HashSet<User>(); userHashSet.add(new User("1", "First")); userHashSet.add(new User("2", "Second")); userHashSet.add(new User("3", "Third")); userHashSet.add(new User("1", "First")); Map<String, User> userHashMap = new HashMap<String, User>(); userHashMap.put("1", new User("1", "First")); userHashMap.put("2", new User("2", "Second")); userHashMap.put("3", new User("3", "Third")); userHashMap.put("1", new User("1", "First")); // ArrayList includes internal iterator System.out.println("=================ArrayList================="); for (User user : userArrayList) { System.out.println(user); System.out.println("User " + user.getName() + " HashCode = " + user.hashCode()); } System.out.println("======================================================"); System.out.println("====================LinkedList================"); // ArrayList includes internal iterator for (User user : userLinkedList) { System.out.println(user); System.out.println("User " + user.getName() + " HashCode = " + user.hashCode()); } System.out.println("======================================================"); System.out.println("====================HashSet================"); for (User user : userHashSet) { System.out.println(user); System.out.println("User " + user.getName() + " HashCode = " + user.hashCode()); } System.out.println("======================================================"); System.out.println("====================HashMap================"); // HashMap doesn't include internal iterator. Should use EntrySet() for (Map.Entry<String, User> user : userHashMap.entrySet()) { System.out.println(user); System.out.println( "User " + user.getValue().getName() + " HashCode = " + user.getValue().hashCode()); } System.out.println("======================================================"); }
@Override public int hashCode() { int result = item != null ? item.hashCode() : 0; result = 31 * result + (owner != null ? owner.hashCode() : 0); result = 31 * result + (datePlaced != null ? datePlaced.hashCode() : 0); result = 31 * result + (dateEnd != null ? dateEnd.hashCode() : 0); result = 31 * result + (startPrice != null ? startPrice.hashCode() : 0); result = 31 * result + (buyer != null ? buyer.hashCode() : 0); result = 31 * result + (currentPrice != null ? currentPrice.hashCode() : 0); return result; }
@Override public int hashCode() { int result = title != null ? title.hashCode() : 0; result = 31 * result + (content != null ? content.hashCode() : 0); result = 31 * result + (author != null ? author.hashCode() : 0); return result; }
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((user == null) ? 0 : user.hashCode()); return result; }
@Override public int hashCode() { int result = (int) (retweetId ^ (retweetId >>> 32)); result = 31 * result + retweetedAt.hashCode(); result = 31 * result + retweetingUser.hashCode(); return result; }
@Override public int hashCode() { int result = id; result = 31 * result + title.hashCode(); result = 31 * result + creator.hashCode(); result = 31 * result + (parent != null ? parent.hashCode() : 0); return result; }
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((login == null) ? 0 : login.hashCode()); result = prime * result + ((senha == null) ? 0 : senha.hashCode()); result = prime * result + ((usuario == null) ? 0 : usuario.hashCode()); return result; }
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((idDaysOfWeek == null) ? 0 : idDaysOfWeek.hashCode()); result = prime * result + ((openTime == null) ? 0 : openTime.hashCode()); result = prime * result + ((user == null) ? 0 : user.hashCode()); result = prime * result + ((userSchedulePK == null) ? 0 : userSchedulePK.hashCode()); return result; }
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((createdDate == null) ? 0 : createdDate.hashCode()); result = prime * result + ((id == null) ? 0 : id.hashCode()); result = prime * result + ((type == null) ? 0 : type.hashCode()); result = prime * result + ((user == null) ? 0 : user.hashCode()); result = prime * result + ((value == null) ? 0 : value.hashCode()); return result; }
@Override public int hashCode() { int result = lastDateUpdate != null ? lastDateUpdate.hashCode() : 0; result = 31 * result + (callList != null ? callList.hashCode() : 0); result = 31 * result + (status != null ? status.hashCode() : 0); result = 31 * result + (user != null ? user.hashCode() : 0); result = 31 * result + (company != null ? company.hashCode() : 0); result = 31 * result + (event != null ? event.hashCode() : 0); return result; }
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((author == null) ? 0 : author.hashCode()); result = prime * result + ((content == null) ? 0 : content.hashCode()); result = prime * result + ((createTime == null) ? 0 : createTime.hashCode()); result = prime * result + ((id == null) ? 0 : id.hashCode()); result = prime * result + ((submission == null) ? 0 : submission.hashCode()); result = prime * result + ((type == null) ? 0 : type.hashCode()); return result; }
/* * (non-Javadoc) * * @see java.lang.Object#hashCode() */ @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((changeValue == null) ? 0 : changeValue.hashCode()); result = prime * result + ((closeDate == null) ? 0 : closeDate.hashCode()); result = prime * result + ((discount == null) ? 0 : discount.hashCode()); result = prime * result + ((id == null) ? 0 : id.hashCode()); result = prime * result + ((idCustomer == null) ? 0 : idCustomer.hashCode()); result = prime * result + ((idTable == null) ? 0 : idTable.hashCode()); result = prime * result + ((openDate == null) ? 0 : openDate.hashCode()); result = prime * result + ((orderStatus == null) ? 0 : orderStatus.hashCode()); result = prime * result + ((product == null) ? 0 : product.hashCode()); result = prime * result + ((productType == null) ? 0 : productType.hashCode()); result = prime * result + ((receivedValue == null) ? 0 : receivedValue.hashCode()); result = prime * result + ((sObservacao == null) ? 0 : sObservacao.hashCode()); result = prime * result + ((totalValue == null) ? 0 : totalValue.hashCode()); result = prime * result + ((user == null) ? 0 : user.hashCode()); return result; }
@Override public int hashCode() { int result = id != null ? id.hashCode() : 0; result = 31 * result + (sex != null ? sex.hashCode() : 0); result = 31 * result + (type != null ? type.hashCode() : 0); result = 31 * result + (size != null ? size.hashCode() : 0); result = 31 * result + (cites != null ? cites.hashCode() : 0); result = 31 * result + (breed != null ? breed.hashCode() : 0); result = 31 * result + (transpNumber != null ? transpNumber.hashCode() : 0); result = 31 * result + (tokenNumber != null ? tokenNumber.hashCode() : 0); result = 31 * result + (dateOfRegister != null ? dateOfRegister.hashCode() : 0); result = 31 * result + (dateOfBirth != null ? dateOfBirth.hashCode() : 0); result = 31 * result + (dateOfSterilization != null ? dateOfSterilization.hashCode() : 0); result = 31 * result + (dateOfFacebook != null ? dateOfFacebook.hashCode() : 0); result = 31 * result + (dateOfTwitter != null ? dateOfTwitter.hashCode() : 0); result = 31 * result + (color != null ? color.hashCode() : 0); result = 31 * result + (description != null ? description.hashCode() : 0); result = 31 * result + (user != null ? user.hashCode() : 0); result = 31 * result + (address != null ? address.hashCode() : 0); result = 31 * result + (active != null ? active.hashCode() : 0); result = 31 * result + (image != null ? image.hashCode() : 0); result = 31 * result + (service != null ? service.hashCode() : 0); return result; }
public int hashCode() { return (dn.hashCode() + user.hashCode()); }
@Override public int hashCode() { int hash = user != null ? user.hashCode() : 0; hash = 31 * hash + (stock != null ? stock.hashCode() : 0); return hash; }
@Override public int hashCode() { int result = message != null ? message.hashCode() : 0; result = 31 * result + (userNotified != null ? userNotified.hashCode() : 0); return result; }
@Override public int hashCode() { int result = user != null ? user.hashCode() : 0; result = 31 * result + (stranger != null ? stranger.hashCode() : 0); return result; }