code: List<List<LinearRing>> assignHolesToShells(
                  final List<LinearRing> shells,
                  final List<LinearRing> holes) {
                  List<List<LinearRing>> holesForShells = new ArrayList<List<LinearRing>>(
                          shells.size());
                  for (int i = 0; i < shells.size(); i++) {
                          holesForShells.add(new ArrayList<LinearRing>());
                  }
  
                  // find homes
                  for (int i = 0; i < holes.size(); i++) {
                          LinearRing testRing = holes.get(i);
                          LinearRing minShell = null;
                          Envelope minEnv = null;
                          Envelope testEnv = testRing.getEnvelopeInternal();
                          Coordinate testPt = testRing.getCoordinateN(0);
                          LinearRing tryRing;
  
                          for (int j = 0; j < shells.size(); j++) {
                                  tryRing = shells.get(j);
  
                                  Envelope tryEnv = tryRing.getEnvelopeInternal();
                                  if (minShell != null) {
                                          minEnv = minShell.getEnvelopeInternal();
                                  }
  
                                  boolean isContained = false;
                                  Coordinate[] coordList = tryRing.getCoordinates();
  
                                  if (tryEnv.contains(testEnv)
                                          && (CGAlgorithms.isPointInRing(testPt, coordList) || (CoordinatesUtils.contains(
                                          coordList, testPt)))) {
                                          isContained = true;
                                  }
  
                                  // check if this new containing ring is smaller than the current
                                  // minimum ring
                                  if (isContained && ((minShell == null) || minEnv.contains(tryEnv))) {
                                          minShell = tryRing;
                                  }
                          }
  
                          if (minShell == null) {
                                  // Logger.getLogger("org.geotools.data.shapefile").warning(
                                  // "polygon found with a hole thats not inside a shell");
                                  // now reverse this bad "hole" and turn it into a shell
                                  shells.add((LinearRing) testRing.reverse());
                                  holesForShells.add(new ArrayList<LinearRing>());
                          } else {
                                  (holesForShells.get(shells.indexOf(minShell))).add(testRing);
  
                          }
                  }
  
                  return holesForShells;
          }
docs: <b>Package private for testing</b>
  
  @param shells
  @param holes