forked from StarOpenSource/Engine
Add ImmutableMap
This commit is contained in:
parent
ae3075770d
commit
ef8cdb87cf
1 changed files with 163 additions and 0 deletions
|
@ -0,0 +1,163 @@
|
|||
/*
|
||||
* STAROPENSOURCE ENGINE SOURCE FILE
|
||||
* Copyright (c) 2024 The StarOpenSource Engine Contributors
|
||||
* Licensed under the GNU Affero General Public License v3
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.staropensource.sosengine.base.types;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.function.BiFunction;
|
||||
|
||||
/**
|
||||
* An unmodifiable {@link Map}.
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @since 1-alpha1
|
||||
*/
|
||||
@SuppressWarnings({ "unused" })
|
||||
public class ImmutableMap<K, V> extends HashMap<K, V> {
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @since 1-alpha1
|
||||
*/
|
||||
public ImmutableMap() {}
|
||||
|
||||
/**
|
||||
* Converts some {@link Map} into a {@link ImmutableMap}.
|
||||
*
|
||||
* @param map {@link Map} to convert
|
||||
* @since 1-alpha1
|
||||
*/
|
||||
public ImmutableMap(@NotNull Map<K, V> map) {
|
||||
for (K key : map.keySet())
|
||||
put(key, map.get(key));
|
||||
}
|
||||
|
||||
/**
|
||||
* Note: This method is a stub.<br/>
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @since 1-alpha1
|
||||
*/
|
||||
@Nullable
|
||||
@Override
|
||||
public V put(K key, V value) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Note: This method is a stub.<br/>
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @since 1-alpha1
|
||||
*/
|
||||
@Nullable
|
||||
@Override
|
||||
public V remove(Object key) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Note: This method is a stub.<br/>
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @since 1-alpha1
|
||||
*/
|
||||
@Override
|
||||
public void putAll(@NotNull Map<? extends K, ? extends V> m) {}
|
||||
|
||||
/**
|
||||
* Note: This method is a stub.<br/>
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @since 1-alpha1
|
||||
*/
|
||||
@Override
|
||||
public void clear() {}
|
||||
|
||||
/**
|
||||
* Note: This method is a stub.<br/>
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @since 1-alpha1
|
||||
*/
|
||||
@Override
|
||||
public void replaceAll(BiFunction<? super K, ? super V, ? extends V> function) {}
|
||||
|
||||
/**
|
||||
* Note: This method is a stub.<br/>
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @since 1-alpha1
|
||||
*/
|
||||
@Nullable
|
||||
@Override
|
||||
public V putIfAbsent(K key, V value) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Note: This method is a stub.<br/>
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @since 1-alpha1
|
||||
*/
|
||||
@Override
|
||||
public boolean remove(Object key, Object value) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Note: This method is a stub.<br/>
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @since 1-alpha1
|
||||
*/
|
||||
@Override
|
||||
public boolean replace(K key, V oldValue, V newValue) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Note: This method is a stub.<br/>
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @since 1-alpha1
|
||||
*/
|
||||
@Nullable
|
||||
@Override
|
||||
public V replace(K key, V value) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Note: This method is a stub.<br/>
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @since 1-alpha1
|
||||
*/
|
||||
@Nullable
|
||||
@Override
|
||||
public V merge(K key, @NotNull V value, @NotNull BiFunction<? super V, ? super V, ? extends V> remappingFunction) {
|
||||
return null;
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue