Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Retrieving object from its hashcode.

Tags:

java

tostring

I can get reference of object through toString if not overloaded for example, "com.app.MyObject@234d80". But, is there anyway to get the object if I have just the string. Is it safe ?

like image 403
Piyush Gupta Avatar asked Feb 22 '26 07:02

Piyush Gupta


1 Answers

No there isn't. Even if there was some global map that returns an object by some key, hashCode wouldn't serve as that key, since two different objects can have the same hashCode.

like image 114
Eran Avatar answered Feb 24 '26 20:02

Eran



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!