@Test public void testGet() { Object[][] tests = { new Object[]{"dd-MM-yyyy", sdf("dd-MM-yyyy")}, new Object[]{"dd.MM.yyyy", sdf("dd.MM.yyyy")}, new Object[]{"yyyy/MM/dd", sdf("yyyy/MM/dd")} }; for (Object[] row : tests) { String pattern = (String) row[0]; SimpleDateFormat expected = (SimpleDateFormat) row[1]; SimpleDateFormat result = new NonAbstractPool().get(pattern); assertEquals(expected, result); } }
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);  }