Re:On Android, Garbage Collection Can Kill You
by jemfinch on Monday June 25, 2012 @02:17PM
(#4157808)
Is this really a credible complaint? Someone who wrote this:
does not seem to have the requisite understanding of how things to work to declare the inferiority of a widely used garbage collector.
[ Parent
| on HN ]
Re:On Android, Garbage Collection Can Kill You
by reeses on Monday June 25, 2012 @05:09PM
(#4158760)
You beat me to this issue. When I read this code I cringed, because it's so naïve it's like reading something intentionally pessimized, such as "if(new String("true").equals(new Boolean(b).toString()){...}" instead of "if(b){...}".
Can you explain what is obviously wrong in this code?
Re:On Android, Garbage Collection Can Kill You
by jemfinch on Monday June 25, 2012 @05:57PM
(#4158947)
You don't need to allocate a new double to call hashCode on it. You can just call hashCode on the double you already have.
Out of curiosity, what language background are you coming from that this isn't obvious?
Python mostly.
The constructor for Double is:
Double(double value)
I thought only 'Double' had the class methods, not 'double'.