Junilu Lacar wrote:I chose to perform the calculation because the class looks like it is designed to be immutable given that the cartesian coordinates are passed to constructor with no getter/setter for them.
Piet Souris wrote:My very first thought is: why is everyone using the sqrt?
Piet Souris wrote:If you add the entry: Double.MAX_VALUE, 0 to your map, you then don't need to test for null.
And yes, Pythagoras, but sqr(x) < rad iff x < rad*rad (x >= 0, assuming)
Stephan van Hulst wrote:D'oh, Campbell has it. That's definitely the most elegant approach in my book.
Piet Souris wrote:. . . a cow from me as well . . .
When all four tires fall off your canoe, how many tiny ads does it take to build a doghouse?
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koophttps://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton