Here you can find the source of putIfAbsent(Map map, S key, T val)
public static <S, T> boolean putIfAbsent(Map<S, T> map, S key, T val)
//package com.java2s; //License from project: Apache License import java.util.*; public class Main { public static <S, T> boolean putIfAbsent(Map<S, T> map, S key, T val) { if (map.containsKey(key)) return false; map.put(key, val); return true; }/*from w w w . ja va 2 s. c o m*/ }