简体   繁体   中英

How to check if a record exists already when using a hash function?

I'm currently programming a telephone banking system and I'm needing to check whether the account record exists already. I've defined a hash function earlier in the program and need to return true/false if the account does/doesn't exist.

Thanks in advance :)

Hash code is not used to verify object equal or not equal method is used for meaning differentiate two objects.

equals(Object obj) : a method provided by java.lang.An object that indicates whether some other object passed as an argument is "equal to" the current instance. The default implementation provided by the JDK is based on memory location — two objects are equal if and only if they are stored in the same memory address.

hashcode() : a method provided by java.lang.An object that returns an integer representation of the object memory address. By default, this method returns a random integer that is unique for each instance. This integer might change between several executions of the application and won't stay the same.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM