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

org.pkl.thirdparty.paguro.collections.ImMap Maven / Gradle / Ivy

Go to download

Shaded fat Jar for pkl-config-java, a Java config library based on the Pkl config language.

There is a newer version: 0.27.1
Show newest version
package org.pkl.thirdparty.paguro.collections;

import java.util.Map;

import org.pkl.thirdparty.jetbrains.annotations.NotNull;

/** An immutable map with no guarantees about its ordering. */
public interface ImMap extends BaseUnsortedMap {

    /** Returns a new map with the given key/value added */
    @NotNull
    @Override ImMap assoc(K key, V val);

    /** Returns a new map with an immutable copy of the given entry added */
    @NotNull
    @Override default ImMap assoc(@NotNull Map.Entry entry) {
        return assoc(entry.getKey(), entry.getValue());
    }

    /** Returns a new map with the given key/value removed */
    @NotNull
    @Override ImMap without(K key);

    /**
     Returns a view of the mappings contained in this map.  The set should actually contain
     UnmodMap.Entry items, but that return signature is illegal in Java, so you'll just have to
     remember.
     */
    @NotNull
    @Override default ImSet> entrySet() {
        return map(e -> (Map.Entry) e)
                .toImSet();
    }

    /** Returns an immutable view of the keys contained in this map. */
    @Override default @NotNull ImSet keySet() {
        return mutable().keySet().immutable();
    }

    /** Returns a mutable version of this mutable map. */
    @NotNull MutMap mutable();

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy