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

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

Go to download

Fat Jar containing pkl-cli, pkl-codegen-java, pkl-codegen-kotlin, pkl-config-java, pkl-core, pkl-doc, and their shaded third-party dependencies.

There is a newer version: 0.27.1
Show newest version
// Copyright 2016 PlanBase Inc. & Glen Peterson
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package org.pkl.thirdparty.paguro.collections;

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

import java.util.Map;

/**
 Interface for mutable (hash) map builder.
 */
public interface MutMap extends BaseUnsortedMap {
    /** {@inheritDoc} */
    @Override
    @Contract(mutates = "this")
    @NotNull MutMap assoc(K key, V val);

    /** {@inheritDoc} */
    @Override
    @Contract(mutates = "this")
    default @NotNull MutMap assoc(@NotNull Map.Entry entry) {
        return assoc(entry.getKey(), entry.getValue());
    }

    @Override
    default @NotNull MutSet> entrySet() {
        return map(e -> (Map.Entry) e).toMutSet();
    }

    /** Returns a mutable view of the keys contained in this map. */
    @Override
    default @NotNull MutSet keySet() {
        return map(e -> ((Map.Entry) e).getKey()).toMutSet();
    }

    /** Returns an immutable version of this mutable map. */
    @NotNull ImMap immutable();

    /** {@inheritDoc} */
    @Override
    @Contract(mutates = "this")
    @NotNull MutMap without(K key);
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy