When VanillaContext keys/values are CharSequences, use StringBuilder as reusable instances

This commit is contained in:
leventov
2015-01-25 08:56:53 +07:00
parent 3842755c67
commit b84e83537d
@@ -251,16 +251,11 @@ class VanillaContext<K, KI, MKI extends MetaBytesInterop<K, ? super KI>,
K reusableKey;
V reusableValue;
MapAndContextLocals(ChronicleMap<K, V> map) {
// try {
// reusableKey = map.newKeyInstance();
// } catch (Exception e) {
// // ignore
// }
// try {
// reusableValue = map.newValueInstance();
// } catch (Exception e) {
// // ignore
// }
// TODO why not using map.newKeyInstance() and newValueInstance()
if (map.keyClass() == CharSequence.class)
reusableKey = (K) new StringBuilder();
if (map.valueClass() == CharSequence.class)
reusableValue = (V) new StringBuilder();
}
}