@Override public boolean equals(Object obj) { if (obj instanceof ConnectionId) { ConnectionId id = (ConnectionId) obj; return address.equals(id.address) && ((ticket != null && ticket.equals(id.ticket)) || (ticket == id.ticket)) && Objects.equals(this.serviceName, id.serviceName); } return false; }
@Override public boolean equals(Object obj) { if (!(obj instanceof AccessControlFilter)) { return false; } if (this == obj){ return true; } AccessControlFilter f=(AccessControlFilter)obj; return this.authManager.equals(f.authManager) && this.table.equals(f.table) && this.user.equals(f.user) && this.strategy.equals(f.strategy) && this.cfVsMaxVersions.equals(f.cfVsMaxVersions); }
@Override public boolean equals(Object obj) { if (obj instanceof ConnectionId) { ConnectionId id = (ConnectionId) obj; return address.equals(id.address) && ((ticket != null && ticket.equals(id.ticket)) || (ticket == id.ticket)) && Objects.equals(this.serviceName, id.serviceName); } return false; }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; ConnectionInfo other = (ConnectionInfo) obj; // `user` is guaranteed to be non-null if (!other.user.equals(user)) return false; if (zookeeperQuorum == null) { if (other.zookeeperQuorum != null) return false; } else if (!zookeeperQuorum.equals(other.zookeeperQuorum)) return false; if (port == null) { if (other.port != null) return false; } else if (!port.equals(other.port)) return false; if (rootNode == null) { if (other.rootNode != null) return false; } else if (!rootNode.equals(other.rootNode)) return false; if (principal == null) { if (other.principal != null) return false; } else if (!principal.equals(other.principal)) return false; if (keytab == null) { if (other.keytab != null) return false; } else if (!keytab.equals(other.keytab)) return false; return true; }
/** * This method find the user in a user list. * return null if no any user was found. **/ private User findUser(ArrayList<User> listUser, User user) { for (User u : listUser) { if (u.equals(user)) { return u; } } return null; }
// Or whatever instance of User you want to compare User custToLookup = new User(idToLookup, "", "", ""); // You could stop here if you only want to know if the instance exist in the list if (list.contains(custToLookup)){ for (User user : list) { if (user.equals(custToLookup) { // Whatever you want to do } } }
@Override public boolean equals(Object obj) { if (obj instanceof ConnectionId) { ConnectionId id = (ConnectionId) obj; return address.equals(id.address) && ((ticket != null && ticket.equals(id.ticket)) || (ticket == id.ticket)) && this.serviceName == id.serviceName; } return false; }
@Override public boolean equals(Object obj) { if (obj instanceof ConnectionId) { ConnectionId id = (ConnectionId) obj; return address.equals(id.address) && ((ticket != null && ticket.equals(id.ticket)) || (ticket == id.ticket)) && Objects.equals(this.serviceName, id.serviceName); } return false; }
User bob = new User("Bob"); if (bob.equals("Bob")) { ... }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; ConnectionInfo other = (ConnectionInfo) obj; // `user` is guaranteed to be non-null if (!other.user.equals(user)) return false; if (zookeeperQuorum == null) { if (other.zookeeperQuorum != null) return false; } else if (!zookeeperQuorum.equals(other.zookeeperQuorum)) return false; if (port == null) { if (other.port != null) return false; } else if (!port.equals(other.port)) return false; if (rootNode == null) { if (other.rootNode != null) return false; } else if (!rootNode.equals(other.rootNode)) return false; if (principal == null) { if (other.principal != null) return false; } else if (!principal.equals(other.principal)) return false; if (keytab == null) { if (other.keytab != null) return false; } else if (!keytab.equals(other.keytab)) return false; return true; }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; ConnectionInfo other = (ConnectionInfo) obj; // `user` is guaranteed to be non-null if (!other.user.equals(user)) return false; if (zookeeperQuorum == null) { if (other.zookeeperQuorum != null) return false; } else if (!zookeeperQuorum.equals(other.zookeeperQuorum)) return false; if (port == null) { if (other.port != null) return false; } else if (!port.equals(other.port)) return false; if (rootNode == null) { if (other.rootNode != null) return false; } else if (!rootNode.equals(other.rootNode)) return false; if (principal == null) { if (other.principal != null) return false; } else if (!principal.equals(other.principal)) return false; if (keytab == null) { if (other.keytab != null) return false; } else if (!keytab.equals(other.keytab)) return false; return true; }
return !(user != null ? !user.equals(ratingId.user) : ratingId.user != null);
if (userEnteredUser.equals(userFromServer)) {