@SuppressWarnings("unchecked")
	public synchronized long generateWayId(String key, List<Long> nodes, List<String> shapes ){

		Long id = null;

		if (totalWays.get(key) == null)
			totalWays.put(key, new ConcurrentHashMap<WayOsm, Long>());

		if (!totalWays.isEmpty())
			id = totalWays.get(key).get(new WayOsm(nodes));

		if (id != null){
			if (shapes != null)
				((WayOsm) getKeyFromValue((Map< String, Map<Object, Long>>) ((Object) totalWays), key, id)).addShapes(shapes);
			return id;
		}
		else{
			idway--;
			WayOsm w = new WayOsm(nodes);
			if (shapes != null)
				w.addShapes(shapes);
			totalWays.get(key).putIfAbsent(w, idway);
			return idway;
		}
	}