Reduce the map to the set of expected keys
515964
private Map<String, Object> filterUnexpectedKeys(Map<String, Object> inputProps) {
        Map<String, Object> outputProps = new HashMap<String, Object>();

        Set<Entry<String, Object>> entries = inputProps.entrySet();
        for (Map.Entry<String, Object> entry : entries) {
            String key = entry.getKey();
            if (EXPECTED_KEYS.contains(key)) {
                outputProps.put(key, entry.getValue());
            }
        }
        return outputProps;
    }
867264
def keys_at(self, x):
		
		return [key for key, segs in self.items() if x in segs]
6503
function flatten(keys) {
  var result = []
  var index = -1
  var length = keys.length

  while (++index < length) {
    if (own.call(alias, keys[index])) {
      result = result.concat(flatten(alias[keys[index]]))
    } else if (Array.isArray(keys[index])) {
      result = result.concat(keys[index])
    } else {
      result.push(keys[index])
    }
  }

  return result
}
1128656
function reduce(map, path) {
		var mapNode, prefix, split, splits = getResourcePathSplits(path),
			subValue, suffix;
		while (splits.length) {
			split = splits.shift();
			suffix = split[1];
			prefix = suffix ? split[0] + '/' : split[0];
			mapNode = map[prefix];
			if (mapNode) {
				if (!suffix || typeof mapNode === 'string') {
					return { map: mapNode, prefix: prefix, suffix: suffix };
				}
				if (typeof mapNode === 'object') {
					subValue = reduce(mapNode, suffix);
					if (subValue) {
						subValue.prefix = prefix + '/' + subValue.prefix;
						return subValue;
					}
				}
			}
		}
		return { map: map, prefix: '', suffix: path };
	}
434083
function(mapping, keys) {
  assert(keys instanceof Array, 'keys must be an array');
  assert(keys.length > 0, 'CompositeKey needs at least one key');

  // Set keys
  this.keys = keys;

  // Set key types
  this.types = [];
  for (var i = 0; i < keys.length; i++) {
    assert(mapping[keys[i]], 'key \'' + keys[i] + '\' is not defined in mapping');
    this.types[i] = mapping[keys[i]];
  }

  // Set covers
  this.covers = keys;
}
858156
public static boolean mapContainsKeys(Map<?, ?> _map, Object... _keys) {
        if (_map == null) {
            return false;
        } else if (_keys == null) {
            return true;
        }
        for (Object key : _keys) {
            if (key != null && !_map.containsKey(key)) {
                return false;
            }
        }
        return true;
    }
1121750
public function reduce(...$keys)
    {
        $keys = $this->normalizeKeys($keys);

        foreach ($this->keys() as $key) {
            if (!in_array($key, $keys, true)) {
                $this->remove($key);
            }
        }

        return $this;
    }
814540
function remove(keys) {
  var self = this

  if (typeof keys === 'string') {
    self.map[keys] = undefined
  } else {
    removeAll(self.map, keys)
  }

  return self
}
1200469
def flatten (d, *keys):
    
    flat = { }

    for k in keys:
        flat = merge(flat, d.pop(k, { }))

    return flat
84475
def intersection(self, keys):
		
		keys = set(keys)
		if not keys:
			return segmentlist()
		seglist = _shallowcopy(self[keys.pop()])
		for key in keys:
			seglist &= self[key]
		return seglist
547285
@SuppressWarnings("unchecked")
  protected void reduce(KEYIN key, Iterable<VALUEIN> values, Context context
                        ) throws IOException, InterruptedException {
    for(VALUEIN value: values) {
      context.write((KEYOUT) key, (VALUEOUT) value);
    }
  }
1071
def nested_get(dictionary, keys):
    
    return reduce(lambda d, k: d[k], keys, dictionary)
1153796
def _apply_to_sets(self, func, operation, keys, *args):
        """"""
        keys = self._list_or_args(keys, args)
        if not keys:
            raise TypeError("{} takes at least two arguments".format(operation.lower()))
        left = self._get_set(keys[0], operation) or set()
        for key in keys[1:]:
            right = self._get_set(key, operation) or set()
            left = func(left, right)
        return left
647385
def replace_keys(d, keymap, force_snake_case):
    
    return {
        to_snake(keymap.get(k, k)) if force_snake_case else keymap.get(k, k):
            v for k, v in d.items()
    }
568073
@SuppressWarnings("unchecked")
	public static <K, V> Map<K, V> filter(Map<K, V> map, K... keys) {
		final Map<K, V> map2 = ObjectUtil.clone(map);
		if (isEmpty(map2)) {
			return map2;
		}

		map2.clear();
		for (K key : keys) {
			if(map.containsKey(key)) {
				map2.put(key, map.get(key));
			}
		}
		return map2;
	}
706050
def _remap_key(key):
    
    if key in KNOWN_PARAMS:
        return key
    if key.lower() in known_params:
        return KNOWN_PARAMS[known_params.index(key.lower())]
    return key
88863
function normalizeMappings(mappings) {
        if (Array.isArray(mappings)) {
            return mappings.reduce(function (normalizedMappings, key) {
                normalizedMappings[key] = key;

                return normalizedMappings;
            }, {});
        }

        return mappings;
    }