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

com.intellij.util.fmap.EmptyFMap Maven / Gradle / Ivy

There is a newer version: 2.1.0-Beta1-1.0.25
Show newest version
// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.util.fmap;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.Collection;
import java.util.Collections;
import java.util.Map;

final class EmptyFMap<@NotNull K, @NotNull V> implements FMap {

  static final EmptyFMap INSTANCE = new EmptyFMap<>();

  @Override
  public @NotNull FMap plus(K key, V value) {
    return new OneKeyFMap<>(key, value);
  }

  @Override
  public @NotNull FMap minus(K key) {
    return this;
  }

  @Override
  public @Nullable V get(K key) {
    return null;
  }

  @Override
  public boolean isEmpty() {
    return true;
  }

  @Override
  public int size() {
    return 0;
  }

  @Override
  public @NotNull Collection keys() {
    return Collections.emptySet();
  }

  @Override
  public @NotNull Map toMap() {
    return Collections.emptyMap();
  }

  @Override
  public String toString() {
    return "[:]";
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy