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

cn.tenmg.flink.jobs.kit.HashMapKit Maven / Gradle / Ivy

There is a newer version: 1.5.7
Show newest version
package cn.tenmg.flink.jobs.kit;

import java.util.HashMap;
import java.util.Map;

/**
 * HashMap配套工具
 * 
 * @param 
 *            键的类型
 * @param 
 *            值的类型
 * 
 * @author June [email protected]
 * 
 * @since 1.1.3
 */
public class HashMapKit {

	private HashMap hashMap = new HashMap();

	/**
	 * 初始化HashMap配套工具,将键值存入后哈希查找表中,并返回HashMapKit对象
	 * 
	 * @param key
	 *            键
	 * @param value
	 *            值
	 * @return 返回HashMapKit对象
	 */
	public static  HashMapKit init(K key, V value) {
		HashMapKit kit = new HashMapKit();
		kit.put(key, value);
		return kit;
	}

	/**
	 * 初始化HashMap配套工具,将键值存入后哈希查找表中,并返回HashMapKit对象
	 * 
	 * @param map
	 *            查找表对象
	 * @return 返回HashMapKit对象
	 */
	public static  HashMapKit init(Map map) {
		HashMapKit kit = new HashMapKit();
		kit.put(map);
		return kit;
	}

	/**
	 * 将键、值存入希查找表中
	 * 
	 * @param map
	 *            指定查找表
	 * @return 返回HashMapKit对象
	 */
	public HashMapKit put(Map map) {
		if (map != null) {
			hashMap.putAll(map);
		}
		return this;
	}

	/**
	 * 将指定查找表中的元素全部放入哈希表中
	 * 
	 * @param key
	 *            键
	 * @param value
	 *            值
	 * @return 返回HashMapKit对象
	 */
	public HashMapKit put(K key, V value) {
		hashMap.put(key, value);
		return this;
	}

	/**
	 * 返回创建的HashMap对象
	 * 
	 * @return 返回HashMap对象
	 */
	public HashMap get() {
		return hashMap;
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy