/**
  * Method that returns the maximum value which is below Integer.MAX_VALUE.
  *
  * @param terrainTypes the list of all TerrainTypes
  * @return the max weight of the TerrainTypes
  */
 private int sanitizeMaxWeight(List<TerrainType> terrainTypes) {
   TerrainType type = terrainTypes.get(terrainTypes.size() - 1);
   if (type.getWeight() == Integer.MAX_VALUE) {
     for (int indx = terrainTypes.size() - 1; indx >= 0; indx--) {
       type = terrainTypes.get(indx);
       if (type.getWeight() != Integer.MAX_VALUE) {
         return (int) (type.getWeight() + Math.ceil((double) type.getWeight() * 0.1));
       }
     }
   }
   return type.getWeight();
 }
 public RGBDynamicColorScheme(final List<TerrainType> terrainTypes) {
   this.terrainColors = new HashMap<>();
   Collections.sort(terrainTypes, TerrainType.getWeightComparator());
   mapColors(terrainTypes);
 }