All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.longdt.vertxservice.util.ShareableKeyMap Maven / Gradle / Ivy

Go to download

A lightweight replacement for vertx-service-proxy. This library is highly optimized for vertx java

There is a newer version: 1.1.1
Show newest version
package com.github.longdt.vertxservice.util;

import io.vertx.core.shareddata.Shareable;

import java.util.HashMap;
import java.util.Map;

public class ShareableKeyMap implements Shareable {
    private final Map data;

    private ShareableKeyMap(Map data) {
        this.data = data;
    }

    public static  ShareableKeyMap of(Map data) {
        return new ShareableKeyMap<>(data);
    }

    public Map unwrap() {
        return data;
    }

    @SuppressWarnings("unchecked")
    @Override
    public ShareableKeyMap copy() {
        Map copiedMap = new HashMap<>(data.size());
        for (var entry : data.entrySet()) {
            copiedMap.put((K) entry.getKey().copy(), entry.getValue());
        }
        return new ShareableKeyMap<>(copiedMap);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy