@Override public Serializable put(String key, Serializable value) { int intKey = map.getIntKey(key); Serializable old = map.get(intKey).get(); if (value instanceof Boolean) { map.set(intKey, new DatatableBool(intKey, (Boolean) value)); } else if (value instanceof Float) { map.set(intKey, new DatatableFloat(intKey, (Float) value)); } else if (value instanceof Integer) { map.set(intKey, new DatatableInt(intKey, (Integer) value)); } else { map.set(intKey, new DatatableSerializable(intKey, value)); } return old; }
@SuppressWarnings("unchecked") @Override public <T extends Serializable> T get(Object key, T defaultValue) { if (!(key instanceof String)) { return defaultValue; } final String keyString = (String) key; final T value; try { value = (T) map.get(keyString).get(); } catch (ClassCastException e) { return defaultValue; } if (value == null) { return defaultValue; } return value; }