Here you can find the source of merge(Map
public static <K, V> Map<K, V> merge(Map<K, V> map, K key, V value)
//package com.java2s; /*//from ww w. ja v a 2 s . c o m * Copyright (c) TESOBE Ltd. 2017. All rights reserved. * * Use of this source code is governed by a GNU AFFERO license that can be found in the LICENSE file. * */ import java.util.Map; public class Main { public static <K, V> Map<K, V> merge(Map<K, V> map, K key, V value) { map.put(key, value); return map; } }