src/main/java/au/org/dcw/twitter/ingest/ui/TweetSanitiserUI.java
private static Map<String, Object> buildFieldStructure(final List<String> cleanFields) {
        Map<String, Object> map = Maps.newTreeMap();

        for (String f : cleanFields) {
            if (! f.contains(".")) {
                map.put(f, null);
            } else {
                final String head = f.substring(0, f.indexOf('.'));
                final String tail = f.substring(f.indexOf('.') + 1);
                final Map<String, Object> subMap = buildFieldStructure(Collections.singletonList(tail));
                if (map.containsKey(head)) {
                    final Map<String, Object> existingMap = (Map<String, Object>) map.get(head);
                    existingMap.putAll(subMap);
                } else {
                    map.put(head, subMap);
                }
            }
        }
        return map;
    }
/**
     * Constructs a nested map of the fields to retain in the stripped version
     * of the the Tweet's JSON.
     *
     * @param cleanFields The list of field names with implied structure (via '.' delimiters).
     * @return A nested map version of <code>cleanFields</code>.
     */
Constructs a nested map of the fields to retain in the stripped version
of the the Tweet's JSON.

@param cleanFields The list of field names with implied structure (via '.' delimiters).
@return A nested map version of cleanFields.
Constructs a nested map of the fields to retain in the stripped version of the the Tweet ' s JSON . @param cleanFields The list of field names with implied structure ( via ' . ' delimiters ) . @return A nested map version of cleanFields .
private static Map<String, Object> buildFieldStructure(final List<String> cleanFields) {
        Map<String, Object> map = Maps.newTreeMap();
        for (String f : cleanFields) {
            if (! f.contains(".")) {
                map.put(f, null);
            } else {
                final String head = f.substring(0, f.indexOf('.'));
                final String tail = f.substring(f.indexOf('.') + 1);
                final Map<String, Object> subMap = buildFieldStructure(Collections.singletonList(tail));
                if (map.containsKey(head)) {
                    final Map<String, Object> existingMap = (Map<String, Object>) map.get(head);
                    existingMap.putAll(subMap);
                } else {
                    map.put(head, subMap);
                }
            }
        }
        return map;
    }
private static Map < String , Object > buildFieldStructure ( final List < String > cleanFields ) { Map < String , Object > map = Maps . newTreeMap ( ) ; for ( String f : cleanFields ) { if ( ! f . contains ( "." ) ) { map . put ( f , null ) ; } else { final String head = f . substring ( 0 , f . indexOf ( '.' ) ) ; final String tail = f . substring ( f . indexOf ( '.' ) + 1 ) ; final Map < String , Object > subMap = buildFieldStructure ( Collections . singletonList ( tail ) ) ; if ( map . containsKey ( head ) ) { final Map < String , Object > existingMap = ( Map < String , Object > ) map . get ( head ) ; existingMap . putAll ( subMap ) ; } else { map . put ( head , subMap ) ; } } } return map ; }
Constructs a nested map of the fields to retain in the stripped version
 of the the Tweet's JSON.
Constructs a nested map of the fields to retain in the stripped version of the the Tweet ' s JSON .