Skip to content

Instantly share code, notes, and snippets.

@agoldis
Last active April 4, 2018 17:30
Show Gist options
  • Save agoldis/c872a6c228d82e874713ed8e7fa9a2a0 to your computer and use it in GitHub Desktop.
Save agoldis/c872a6c228d82e874713ed8e7fa9a2a0 to your computer and use it in GitHub Desktop.
Comment frustration - rename and decouple
public Boolean isWithinCircle(Double x, Double y, Double radius) {
final Double TWO = new Double(2);
return (Math.pow(x, TWO) + Math.pow(y, TWO)) < Math.pow(radius, TWO);
}
public List<PhotosCollection> getPhotosCollectionsWithinRadius(List<Locations> locationsList) {
List<PhotosCollection> photosCollection = new ArrayList<>();
final Double RADIUS = new Double(10);
for(Location location: locationsList) {
if(isWithinCircle(location.x, location.y, RADIUS)) {
photosCollection.add(location.getPhotosCollection());
}
}
return photosCollection;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment