### Question:
GeographicUtilities { public static Map<List<LatLonAlt>, Collection<List<LatLonAlt>>> decomposePositionsToPolygons(List<LatLonAlt> rings) { Map<List<LatLonAlt>, Collection<List<LatLonAlt>>> polygons = New.map(); LatLonAlt startPoint = null; List<LatLonAlt> curPoly = New.list(); Collection<List<LatLonAlt>> holes = null; List<LatLonAlt> deduped = removeDuplicates(rings); for (LatLonAlt lla : deduped) { curPoly.add(lla); if (startPoint == null) { startPoint = lla; continue; } if (startPoint.equals(lla)) { if (curPoly.size() > 2) { PolygonWinding winding = getNaturalWinding(curPoly); if (winding == PolygonWinding.CLOCKWISE || deduped.size() == curPoly.size()) { holes = New.collection(); polygons.put(curPoly, holes); } else { if (holes != null) { holes.add(curPoly); } else { LOGGER.error("Polygon hole listed before polygon or incorrect winding for polygon."); } } } curPoly = New.list(); startPoint = null; } } if (!curPoly.isEmpty()) { LOGGER.warn("Encountered unclosed polygon while reading shapefile."); } return polygons; } private  GeographicUtilities(); static Map<List<LatLonAlt>, Collection<List<LatLonAlt>>> decomposePositionsToPolygons(List<LatLonAlt> rings); static PolygonWinding getNaturalWinding(List<LatLonAlt> vertices); static List<ScreenPosition> toScreenPositions(List<? extends GeographicPosition> positions,
            ScreenBoundingBox screenBounds);  }### Answer:
@Test public void testDecomposePositionsToPolygons() { List<LatLonAlt> exteriorRing1 = createRings(0., 0., 0., 50., 50., 50., 50., 0., 0., 0.); List<LatLonAlt> exteriorRing2 = createRings(1., 1., 1., 50., 50., 50., 50., 1., 1., 1.); List<LatLonAlt> exteriorRing3 = createRings(2., 2., 2., 50., 50., 50., 50., 2., 2., 2.); List<LatLonAlt> interiorRing1 = createRings(10., 10., 20., 10., 20., 20., 10., 20., 10., 10.); List<LatLonAlt> interiorRing2 = createRings(25., 25., 35., 25., 35., 35., 25., 35., 25., 25.); List<LatLonAlt> all = New.list(); all.addAll(exteriorRing1); all.addAll(exteriorRing2); all.addAll(interiorRing1); all.addAll(exteriorRing3); all.addAll(interiorRing1); all.addAll(interiorRing2); Map<List<LatLonAlt>, Collection<List<LatLonAlt>>> decomposition = GeographicUtilities.decomposePositionsToPolygons(all); Assert.assertTrue("There must be one hole in the left side polygon.", decomposition.size() == 3); for (Entry<List<LatLonAlt>, Collection<List<LatLonAlt>>> entry : decomposition.entrySet()) { if (entry.getKey().get(0).getLonD() == 0.) { Assert.assertTrue("The fist polygon should have no holes.", entry.getValue().isEmpty()); } else if (entry.getKey().get(0).getLonD() == 1.) { Assert.assertTrue("The second polygon should have 1 holes.", entry.getValue().size() == 1); } else if (entry.getKey().get(0).getLonD() == 2.) { Assert.assertTrue("The third polygon should have 2 holes.", entry.getValue().size() == 2); } } }