@Override
    public Map<String, Object> apply(final Map<String, Object> row) {
        Map<String, Object> cleanRow, filteredRow;

        // Make sure the row isn't null.
        if (row == null) {
            cleanRow = new LinkedHashMap<>();
        } else {
            cleanRow = new LinkedHashMap<>(row);
        }

        // Copy the row so we avoid concurrent modifications.
        filteredRow = new LinkedHashMap<>();

        // Iterate through the requested columns and add/override the ones
        // the user wants to see.
        for (String column : columns) {
            if (cleanRow.containsKey(column)) {
                filteredRow.put(column, cleanRow.get(column));
            } else {
                filteredRow.put(column, null);
            }
        }

        return filteredRow;
    }
@ Override public Map < String , Object > apply ( final Map < String , Object > row ) { Map < String , Object > cleanRow , filteredRow ; if ( row == null ) { cleanRow = new LinkedHashMap < > ( ) ; } else { cleanRow = new LinkedHashMap < > ( row ) ; } filteredRow = new LinkedHashMap < > ( ) ; for ( String column : columns ) { if ( cleanRow . containsKey ( column ) ) { filteredRow . put ( column , cleanRow . get ( column ) ) ; } else { filteredRow . put ( column , null ) ; } } return filteredRow ; }
Apply the filter.

@param row The data row to apply this filter to.
@return A row that only contains the configured columns.