Last active
April 4, 2018 17:30
-
-
Save agoldis/c872a6c228d82e874713ed8e7fa9a2a0 to your computer and use it in GitHub Desktop.
Comment frustration - rename and decouple
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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