News for hackers. Stuff that matters.
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:

    public int hashCode() {
        return new Double(x).hashCode() ^ new Double(y).hashCode();
    }
does not seem to have the requisite understanding of how things to work to declare the inferiority of a widely used garbage collector.
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){...}".
Re:On Android, Garbage Collection Can Kill You by swah on Monday June 25, 2012 @05:01PM (#4158724)
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?

Re:On Android, Garbage Collection Can Kill You by swah on Tuesday June 26, 2012 @12:07PM (#4162642)
Python mostly.

The constructor for Double is:

    Double(double value)
I thought only 'Double' had the class methods, not 'double'.
Re:On Android, Garbage Collection Can Kill You by jemfinch on Friday June 29, 2012 @12:16AM (#4175214)
You're right, I forgot that there's such a distinction in Java.