Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* Copyright 2016 Yetamine
*
* 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 net.yetamine.lang.collections;
import java.io.Serializable;
import java.util.Map;
import java.util.Objects;
import java.util.function.BiFunction;
import java.util.function.Function;
/**
* A compatibility-retaining child of {@link Mapping}.
*
* @param
* the type of keys
* @param
* the type of values
*
* @deprecated Use {@link Mapping} instead as this interface adds nothing new
* and exists for compatibility in this version.
*/
@Deprecated
public interface MappingStorage extends Mapping {
/**
* Returns an instance that stores nothing and always returns {@code null}.
*
* @param
* the type of keys
* @param
* the type of values
*
* @return the instance of an empty immutable instance
*/
static MappingStorage empty() {
return EmptyMappingStorage.INSTANCE.cast();
}
/**
* Returns a new instance based on the given {@link Map} instance.
*
*
* The result inherits all characteristics (like thread safety) from the
* given map which is used as the underlying storage.
*
* @param
* the type of keys
* @param
* the type of values
* @param map
* the map to use as the underlying storage. It must not be
* {@code null}.
*
* @return the instance using the given map
*/
static MappingStorage adapting(Map map) {
return new MappingStorageAdapter<>(map);
}
}
/**
* A singleton implementing an empty {@link MappingStorage}.
*/
enum EmptyMappingStorage implements MappingStorage