class MapFunctions {

    public static <T, S> Pair<Map<T, S>, Map<T, S>> simplePartition(Map<T, S> map, Predicate<Entry<T, S>> test) {
        if (map == null || map.isEmpty()) {
            return Pair.of(emptyMap(), emptyMap());
        }

        Map<Boolean, List<Entry<T, S>>> partitioned = map.entrySet().stream().collect(partitioningBy(test));
        Map<T, S> left = partitioned.get(true).stream().collect(Collectors.toMap(Entry::getKey, Entry::getValue));
        Map<T, S> right = partitioned.get(false).stream().collect(Collectors.toMap(Entry::getKey, Entry::getValue));
        return Pair.of(left, right);
    }

    private  MapFunctions();

}