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

com.github.longdt.vertxservice.util.ShareableSet 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.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

public class ShareableSet implements Shareable {
    private final Set data;

    private ShareableSet(Set data) {
        this.data = data;
    }

    public static  ShareableSet of(Set data) {
        return new ShareableSet<>(data);
    }

    public Set unwrap() {
        return data;
    }

    @SuppressWarnings("unchecked")
    @Override
    public ShareableSet copy() {
        Set copiedList = new HashSet<>(data.size());
        for (var shareable : data) {
            copiedList.add(shareable != null ? (E) shareable.copy() : null);
        }
        return new ShareableSet<>(copiedList);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy