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

org.eclipse.collections.impl.map.fixed.AbstractMemoryEfficientMutableMap Maven / Gradle / Ivy

Go to download

Builds the commons-text. Requires eclipse-collections-api be built first and be excluded from any other poms requiring it.

There is a newer version: 11.1.0-r13
Show newest version
/*
 * Copyright (c) 2022 Goldman Sachs and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * and Eclipse Distribution License v. 1.0 which accompany this distribution.
 * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
 * and the Eclipse Distribution License is available at
 * http://www.eclipse.org/org/documents/edl-v10.php.
 */

package org.eclipse.collections.impl.map.fixed;

import java.util.Map;
import java.util.Set;

import org.eclipse.collections.api.block.function.Function;
import org.eclipse.collections.api.block.function.Function0;
import org.eclipse.collections.api.block.function.Function2;
import org.eclipse.collections.api.block.predicate.Predicate2;
import org.eclipse.collections.api.block.procedure.Procedure;
import org.eclipse.collections.api.factory.Maps;
import org.eclipse.collections.api.map.FixedSizeMap;
import org.eclipse.collections.api.map.MutableMap;
import org.eclipse.collections.api.tuple.Pair;
import org.eclipse.collections.impl.list.fixed.ArrayAdapter;
import org.eclipse.collections.impl.map.mutable.AbstractMutableMap;
import org.eclipse.collections.impl.map.mutable.UnifiedMap;

abstract class AbstractMemoryEfficientMutableMap
        extends AbstractMutableMap
        implements FixedSizeMap
{
    @Override
    public V put(K key, V value)
    {
        throw new UnsupportedOperationException("Cannot call put() on " + this.getClass().getSimpleName());
    }

    @Override
    public V remove(Object key)
    {
        throw new UnsupportedOperationException("Cannot call remove() on " + this.getClass().getSimpleName());
    }

    @Override
    public void putAll(Map map)
    {
        throw new UnsupportedOperationException("Cannot call putAll() on " + this.getClass().getSimpleName());
    }

    @Override
    public void clear()
    {
        throw new UnsupportedOperationException("Cannot call clear() on " + this.getClass().getSimpleName());
    }

    @Override
    public V removeKey(K key)
    {
        throw new UnsupportedOperationException("Cannot call removeKey() on " + this.getClass().getSimpleName());
    }

    @Override
    public boolean removeAllKeys(Set keys)
    {
        throw new UnsupportedOperationException("Cannot call removeAllKeys() on " + this.getClass().getSimpleName());
    }

    @Override
    public boolean removeIf(Predicate2 predicate)
    {
        throw new UnsupportedOperationException("Cannot call removeIf() on " + this.getClass().getSimpleName());
    }

    @Override
    public  MutableMap collectKeysAndValues(
            Iterable iterable,
            Function keyFunction,
            Function valueFunction)
    {
        throw new UnsupportedOperationException("Cannot call collectKeysAndValues() on " + this.getClass().getSimpleName());
    }

    @Override
    public V updateValue(K key, Function0 factory, Function function)
    {
        throw new UnsupportedOperationException(this.getClass().getSimpleName() + ".updateValue() not implemented yet");
    }

    @Override
    public 

V updateValueWith(K key, Function0 factory, Function2 function, P parameter) { throw new UnsupportedOperationException(this.getClass().getSimpleName() + ".updateValueWith() not implemented yet"); } @Override public MutableMap newEmpty() { return Maps.mutable.empty(); } @Override public MutableMap newEmpty(int capacity) { return UnifiedMap.newMap(capacity); } @Override public MutableMap withAllKeyValues(Iterable> keyValues) { MutableMap map = this; for (Pair keyVal : keyValues) { map = map.withKeyValue(keyVal.getOne(), keyVal.getTwo()); } return map; } @Override public MutableMap withAllKeyValueArguments(Pair... keyValues) { return this.withAllKeyValues(ArrayAdapter.adapt(keyValues)); } @Override public MutableMap withoutAllKeys(Iterable keys) { MutableMap map = this; for (K key : keys) { map = map.withoutKey(key); } return map; } @Override public FixedSizeMap tap(Procedure procedure) { this.forEach(procedure); return this; } @Override public abstract FixedSizeMap select(Predicate2 predicate); @Override public abstract FixedSizeMap collectValues(Function2 function); @Override public abstract FixedSizeMap collect(Function2> function); @Override public abstract FixedSizeMap reject(Predicate2 predicate); }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy