private static Location scanLocations ( List < Location > locations , LocationPredicate predicate ) { Location location = null ; for ( Location l : locations ) { if ( location == null ) { location = l ; } else { if ( predicate . accept ( location , l ) ) { location = l ; } } } return location ; }
Used for scanning through a list of locations ; assumes the locations given will have at least one value otherwise we will get a null pointer