Build a navigation mesh based on a tile map

@param map The map to build the navigation mesh from
@param tileBased True if we'll use the tiles for the mesh initially
rather than quad spacing
@return The newly created navigation mesh
968488
public NavMesh build(TileBasedMap map, boolean tileBased) {
		this.tileBased = tileBased;
		
		ArrayList spaces = new ArrayList();
		
		if (tileBased) {
			for (int x=0;x<map.getWidthInTiles();x++) {
				for (int y=0;y<map.getHeightInTiles();y++) {
					if (!map.blocked(this, x, y)) {
						spaces.add(new Space(x,y,1,1));
					}
				}
			}
		} else {
			Space space = new Space(0,0,map.getWidthInTiles(),map.getHeightInTiles());
		
			subsection(map, space, spaces);
		}
		
		while (mergeSpaces(spaces)) {}
		linkSpaces(spaces);
		
		return new NavMesh(spaces);
	}
454924
public void append(Map<?, ?> map) {
		if (map == null || map.size() == 0)
			return;

		for (Map.Entry<?, ?> entry : map.entrySet()) {
			put(StringConverter.toString(entry.getKey()), StringConverter.toNullableString(entry.getValue()));
		}
	}
1108040
public static <K, V> Map<K, V> toSortedMap(Map<K, V> map, Comparator<? super K> comparator) {
        Map<K, V> sortedMap;
        if (comparator == null)
            sortedMap = new LinkedHashMap<>();
        else
            sortedMap = new TreeMap<>(comparator);
        sortedMap.putAll(map);
        return sortedMap;
    }
890149
public static <K, V> Map<K, V> newMap(Map<K, V> initMap) {
        return new HashMap<>(initMap);
    }
931572
public static TileRendererLayer createTileRendererLayer(
            TileCache tileCache, IMapViewPosition mapViewPosition,
            MapDataStore mapFile, XmlRenderTheme renderTheme) {
        TileRendererLayer tileRendererLayer = new TileRendererLayer(tileCache, mapFile,
                mapViewPosition, AndroidGraphicFactory.INSTANCE);
        tileRendererLayer.setXmlRenderTheme(renderTheme);
        return tileRendererLayer;
    }
1128956
public static Map<String, Tag<?>> cloneMap(Map<String, Tag<?>> map) {
        if (map == null) {
            return null;
        }

        Map<String, Tag<?>> newMap = new HashMap<String, Tag<?>>();
        for (Entry<String, Tag<?>> entry : map.entrySet()) {
            newMap.put(entry.getKey(), entry.getValue().clone());
        }
        return newMap;
    }
1337536
@NonNull
  public static <K, V> ImmutableMap<K, V> append(
      @NonNull ImmutableMap<K, V> map, @NonNull K newKey, @NonNull V newValue) {
    ImmutableMap.Builder<K, V> builder = ImmutableMap.builder();
    for (Map.Entry<K, V> entry : map.entrySet()) {
      if (!entry.getKey().equals(newKey)) {
        builder.put(entry);
      }
    }
    builder.put(newKey, newValue);
    return builder.build();
  }
1039212
public static <K, KK, VV> Map<KK, VV> getAndPutMapIfAbsent(final Map<K, Map<KK, VV>> map, final K key) {
        Map<KK, VV> v = map.get(key);

        if (v == null) {
            v = new HashMap<>();
            v = map.put(key, v);
        }

        return v;
    }
379898
public static Map<String, Object> camelToUnderline(Map<String, Object> map) {
        Map<String, Object> newMap = new HashMap<>();
        for (String key : map.keySet()) {
            newMap.put(camelToUnderline(key), map.get(key));
        }
        return newMap;
    }
1131849
public static ValueMap map(Object... map) {
        if (map.length / 2 * 2 != map.length)
            throw new IllegalArgumentException("Arguments should be <String> key - <?> value pairs");

        Builder builder = new Builder();
        for (int i = 0; i < map.length; i += 2)
            builder.put((String)map[i], map[i + 1]);

        return builder.build();
    }
744409
public static <K, V, M extends Map<K, V>> UnmodifiableMutableMap<K, V> of(M map)
    {
        if (map == null)
        {
            throw new IllegalArgumentException("cannot create a UnmodifiableMutableMap for null");
        }
        return new UnmodifiableMutableMap<K, V>(MapAdapter.adapt(map));
    }
38254
static public <K,V> Map<K,V> map(Map<?,?> map)
	{
		return (Map<K,V>)map;
	}
999978
public boolean clear(TileBasedMap map, Space space) {
		if (tileBased) {
			return true;
		}
		
		float x = 0;
		boolean donex = false;
		
		while (x < space.getWidth()) {
			float y = 0;
			boolean doney = false;
			
			while (y < space.getHeight()) {
				sx = (int) (space.getX()+x);
				sy = (int) (space.getY()+y);
				
				if (map.blocked(this, sx, sy)) {
					return false;
				}
				
				y += 0.1f;
				if ((y > space.getHeight()) && (!doney)) {
					y = space.getHeight();
					doney = true;
				}
			}
			
			
			x += 0.1f;
			if ((x > space.getWidth()) && (!donex)) {
				x = space.getWidth();
				donex = true;
			}
		}
		
		return true;
	}
887510
public static <K, V> Map<K, V> immutableMapView(Map<K, V> map) {
        if (map instanceof ImmutableMap<?, ?>) {
            return map;
        }
        return Collections.unmodifiableMap(map);
    }
168134
public static <K, V> NavigableMap<K, V> nullToEmpty(final NavigableMap<K, V> map) {
        return map == null ? N.<K, V> emptyNavigableMap() : map;
    }
482625
function createMap(divId) {
  const source = new OSM();
  const layer = new TileLayer({
    source: source
  });
  const map = new Map({
    layers: [layer],
    target: divId,
    view: new View({
      center: [0, 0],
      zoom: 2
    })
  });
  const zoomslider = new ZoomSlider();
  map.addControl(zoomslider);
  return map;
}
1281449
@SuppressWarnings("unchecked")
	protected Map<String, Object> getNestedMap(Map<String, Object> map, String key) {
		Object value = map.get(key);
		if (value == null) {
			return Collections.emptyMap();
		}
		return (Map<String, Object>) value;
	}