@Test public void testGet__cache() { SimpleDateFormat sdf1 = SimpleDateFormatPool.get("dd/MM/yyyy"); SimpleDateFormat sdf2 = SimpleDateFormatPool.get("dd/MM/yyyy"); assertSame(sdf1, sdf2); }
public static SimpleDateFormat get(String pattern) { Map<String, SimpleDateFormat> map = pool.get(); SimpleDateFormat sdf = map.get(pattern); if (sdf == null) { sdf = new SimpleDateFormat(pattern); sdf.setLenient(false); map.put(pattern, sdf); } return sdf; }
SimpleDateFormatPool { public static SimpleDateFormat get(String pattern) { Map<String, SimpleDateFormat> map = pool.get(); SimpleDateFormat sdf = map.get(pattern); if (sdf == null) { sdf = new SimpleDateFormat(pattern); sdf.setLenient(false); map.put(pattern, sdf); } return sdf; } }
SimpleDateFormatPool { public static SimpleDateFormat get(String pattern) { Map<String, SimpleDateFormat> map = pool.get(); SimpleDateFormat sdf = map.get(pattern); if (sdf == null) { sdf = new SimpleDateFormat(pattern); sdf.setLenient(false); map.put(pattern, sdf); } return sdf; }  }
SimpleDateFormatPool { public static SimpleDateFormat get(String pattern) { Map<String, SimpleDateFormat> map = pool.get(); SimpleDateFormat sdf = map.get(pattern); if (sdf == null) { sdf = new SimpleDateFormat(pattern); sdf.setLenient(false); map.put(pattern, sdf); } return sdf; }  static SimpleDateFormat get(String pattern); }
SimpleDateFormatPool { public static SimpleDateFormat get(String pattern) { Map<String, SimpleDateFormat> map = pool.get(); SimpleDateFormat sdf = map.get(pattern); if (sdf == null) { sdf = new SimpleDateFormat(pattern); sdf.setLenient(false); map.put(pattern, sdf); } return sdf; }  static SimpleDateFormat get(String pattern);  }