Here are some things that could be improved in your solution:
- Instead of
(Double, Double) you could have a Coordinate case class;
- Instead of
Seq[Seq[(Double, Double)]] - MultiPolygon(List(Polygon(List(Coordinate)));
- Lack of unit tests;
- Some unsafe places in the code (
polygon.head for example can throw an exception; so could pair(0) -> pair(1)), so the solution wasn't tested with empty polygons or invalid args.
- Code could be organized better - json, arg parsing, logic could be put into separate files.
isLocationInRegion looks rather scary and could use some comments, or nested methods that have descriptive names;
- The repo contains a jar instead but does not explain how to build it;
Here are some things that could be improved in your solution:
(Double, Double)you could have aCoordinatecase class;Seq[Seq[(Double, Double)]]-MultiPolygon(List(Polygon(List(Coordinate)));polygon.headfor example can throw an exception; so couldpair(0) -> pair(1)), so the solution wasn't tested with empty polygons or invalid args.isLocationInRegionlooks rather scary and could use some comments, or nested methods that have descriptive names;