public static <K, V> Map<K, V> wrap(final Map<K, V> source) {
        if (source != null && !source.isEmpty()) {
            return new HashMap<>(source);
        }
        return new HashMap<>();
    }
Wraps a possibly null map in an immutable wrapper.

@param <K>    the key type
@param <V>    the value type
@param source map to wrap.
@return the map
core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/CollectionUtils.java