}
/**
- * Compares both user instances. This method returns -1 if second
- * instance is null.
+ * Compares both user instances. This method returns -1 if second instance
+ * is null.
* <p>
* @param user1 User instance 1
* @param user2 User instance 2
} else if (null == targetUser) {
// Throw NPE
throw new NullPointerException("targetUser is null"); //NOI18N
+ } else if (Objects.equals(sourceUser, targetUser)) {
+ // Is exactly the same!
+ throw new IllegalArgumentException("sourcerUser and targetUser are the same."); //NOI18N
}
// Is contact set?
/**
* Returns a formatted string from given user's locale and Date instance
* <p>
- * @param user User instance
+ * @param user User instance
* @param date Date instance
* <p>
* @return A formatted string from Date instance