Here you can find the source of getFormatter(String pattern)
private static synchronized SimpleDateFormat getFormatter(String pattern)
//package com.java2s; //License from project: Open Source License import java.text.SimpleDateFormat; import java.util.HashMap; import java.util.Map; public class Main { private static final Map<String, SimpleDateFormat> formatters = new HashMap<String, SimpleDateFormat>(); private static synchronized SimpleDateFormat getFormatter(String pattern) { SimpleDateFormat sdf = null; if (formatters.containsKey(pattern)) { sdf = formatters.get(pattern); } else {// ww w .j a v a 2s. com sdf = new SimpleDateFormat(pattern); formatters.put(pattern, sdf); } return sdf; } }