001 /* 002 * Copyright 2010-2015 JetBrains s.r.o. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 package org.jetbrains.kotlin.util.userDataHolder.keyFMap; 017 018 import com.intellij.openapi.util.Key; 019 import org.jetbrains.annotations.NotNull; 020 import org.jetbrains.annotations.Nullable; 021 022 /** 023 * An immutable map optimized for storing few {@link Key} entries with relatively rare updates 024 * To construct a map, start with {@link KeyFMap#EMPTY_MAP} and call {@link #plus} and {@link #minus} 025 */ 026 public interface KeyFMap { 027 KeyFMap EMPTY_MAP = new EmptyFMap(); 028 029 @NotNull 030 <V> KeyFMap plus(@NotNull Key<V> key, @NotNull V value); 031 @NotNull 032 KeyFMap minus(@NotNull Key<?> key); 033 034 @Nullable 035 <V> V get(@NotNull Key<V> key); 036 037 @NotNull 038 Key[] getKeys(); 039 040 String toString(); 041 042 boolean isEmpty(); 043 }