final Collection<Element> elements = new HashSet<Element>(map.size(), 1f);
final Collection<Entry> entries = new HashSet<Entry>();
for (Map.Entry<? extends K, ? extends V> entry : map.entrySet()) {
if(entry.getValue() == null) throw new NullPointerException();
final Element e = new Element(entry.getKey(), entry.getValue());
final Duration expiry;
if(ehcache.isKeyInCache(entry.getKey())) {
expiry = cfg.getExpiryPolicy().getExpiryForUpdate();
} else {
expiry = cfg.getExpiryPolicy().getExpiryForCreation();
}