class CommonUtils {

	@SuppressWarnings("unchecked")
	public static LinkedHashMap<String, Object> flatNestedLinkedHashMap(String notation, Map<String, Object> nestedMap) {
		LinkedHashMap<String, Object> flatNestedMap = new LinkedHashMap<String, Object>();
		String prefixKey = notation != null ? notation + "." : "";
		for (Map.Entry<String, Object> entry : nestedMap.entrySet()) {
			if (entry.getValue() instanceof String || entry.getValue() instanceof Long || entry.getValue() instanceof Integer  || entry.getValue() instanceof Float || entry.getValue() instanceof Double) {
				flatNestedMap.put(prefixKey + entry.getKey(), entry.getValue());
			}
			if (entry.getValue() instanceof Map) {
				flatNestedMap.putAll(flatNestedMap(prefixKey + entry.getKey(), (Map<String, Object>) entry.getValue()));
			}
			if (entry.getValue() instanceof ArrayList) {
				Gson gson = new Gson();
				flatNestedMap.put("list",gson.toJson(entry.getValue()));

			}
		}
		return flatNestedMap;
	}

	private  CommonUtils();

}