diff --git a/src/main/java/net/openhft/chronicle/map/VanillaContext.java b/src/main/java/net/openhft/chronicle/map/VanillaContext.java index 3e45bba02..02b87c848 100644 --- a/src/main/java/net/openhft/chronicle/map/VanillaContext.java +++ b/src/main/java/net/openhft/chronicle/map/VanillaContext.java @@ -251,16 +251,11 @@ class VanillaContext, K reusableKey; V reusableValue; MapAndContextLocals(ChronicleMap 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(); } }