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

com.github.longdt.vertxservice.util.ShareableMap 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 ShareableMap implements Shareable {
    private final Map data;

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

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

    public Map unwrap() {
        return data;
    }

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy