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

org.mvnsearch.boot.xtermjs.MutableContext Maven / Gradle / Ivy

There is a newer version: 1.3.3
Show newest version
package org.mvnsearch.boot.xtermjs;

import org.jetbrains.annotations.NotNull;
import reactor.util.context.Context;

import java.util.HashMap;
import java.util.Map;
import java.util.stream.Stream;

/**
 * Mutable context
 *
 * @author linux_china
 */
public class MutableContext implements Context {

	HashMap holder = new HashMap<>();

	@SuppressWarnings("unchecked")
	@NotNull
	@Override
	public  T get(@NotNull Object key) {
		return (T) holder.get(key);
	}

	@Override
	public boolean hasKey(@NotNull Object key) {
		return holder.containsKey(key);
	}

	@NotNull
	@Override
	public Context put(@NotNull Object key, @NotNull Object value) {
		holder.put(key, value);
		return this;
	}

	@NotNull
	@Override
	public Context delete(@NotNull Object key) {
		holder.remove(key);
		return this;
	}

	@Override
	public int size() {
		return holder.size();
	}

	@NotNull
	@Override
	public Stream> stream() {
		return holder.entrySet().stream();
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy