public Map<String, Object> buildNewNestedMap(String[] mapKeys,
			Object propertyValue) {
		Map<String, Object> rootMap = new HashMap<String, Object>();
		Map<String, Object> higherNestedMap = new HashMap<String, Object>();
		Map<String, Object> deeperNestedMap = new HashMap<String, Object>();

		// if only one key, add to the rootMap and return
		if (mapKeys.length - 1 == 0) {
			rootMap.put(mapKeys[0], propertyValue);
			return rootMap;
		}
		// after if we need min. one nestedMap

		// add deeperNestedMap to the higherNestedMap with the first key
		higherNestedMap.put(mapKeys[0], deeperNestedMap);

		// add the first nested map to the root map
		rootMap.putAll(higherNestedMap);

		// switch the higherNestedMap to the deeperNestedMap
		higherNestedMap = deeperNestedMap;

		// if mapKeys.length > 1
		for (int i = 1; i <= mapKeys.length - 1; i++) {
			if (i == mapKeys.length - 1) {
				higherNestedMap.put(mapKeys[i], propertyValue);
				break;
			}

			// make a new deeperNestedMap
			deeperNestedMap = new HashMap<String, Object>();

			// add deeperNestedMap to the higherNestedMap with the first key[i]
			higherNestedMap.put(mapKeys[i], deeperNestedMap);

			// switch the higherNestedMap to the deeperNestedMap
			higherNestedMap = deeperNestedMap;
		}

		return rootMap;
	}
public Map < String , Object > buildNewNestedMap ( String [ ] mapKeys , Object propertyValue ) { Map < String , Object > rootMap = new HashMap < String , Object > ( ) ; Map < String , Object > higherNestedMap = new HashMap < String , Object > ( ) ; Map < String , Object > deeperNestedMap = new HashMap < String , Object > ( ) ; if ( mapKeys . length - 1 == 0 ) { rootMap . put ( mapKeys [ 0 ] , propertyValue ) ; return rootMap ; } higherNestedMap . put ( mapKeys [ 0 ] , deeperNestedMap ) ; rootMap . putAll ( higherNestedMap ) ; higherNestedMap = deeperNestedMap ; for ( int i = 1 ; i <= mapKeys . length - 1 ; i ++ ) { if ( i == mapKeys . length - 1 ) { higherNestedMap . put ( mapKeys [ i ] , propertyValue ) ; break ; } deeperNestedMap = new HashMap < String , Object > ( ) ; higherNestedMap . put ( mapKeys [ i ] , deeperNestedMap ) ; higherNestedMap = deeperNestedMap ; } return rootMap ; }
Creates a new {@link Map} from a given array of keys and a value. If
necessary, nested maps will be created for all given keys.

@param mapKeys
array of keys as {@link String}
@param propertyValue
the value to be stored at the "deeped" nested map
@return a {@link Map}, containing nested maps for all keys and the given
value