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

io.polaris.core.map.FluentMap Maven / Gradle / Ivy

There is a newer version: 3.2.1
Show newest version
package io.polaris.core.map;

import java.util.Map;
import java.util.function.Consumer;

/**
 * @author Qt
 * @since 1.8
 */
public class FluentMap {

	private final Map map;

	public FluentMap(Map map) {
		this.map = map;
	}

	public static  FluentMap of(Map map) {
		return new FluentMap<>(map);
	}

	public Map get() {
		return map;
	}

	public FluentMap visit(Consumer> consumer) {
		consumer.accept(map);
		return this;
	}


	public FluentMap put(K key, V value) {
		map.put(key, value);
		return this;
	}

	public FluentMap remove(Object key) {
		map.remove(key);
		return this;
	}

	public FluentMap putAll(Map m) {
		map.putAll(m);
		return this;
	}

	public FluentMap clear() {
		map.clear();
		return this;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy