From a2aaaa3246f260bea5ebdfff3688693fd8ff245e Mon Sep 17 00:00:00 2001 From: boundedbuffer Date: Sun, 7 Dec 2014 22:05:40 +0000 Subject: [PATCH] change the example to use CharSequence --- README.md | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 9bb5765a4..34a51534c 100644 --- a/README.md +++ b/README.md @@ -350,18 +350,17 @@ supports the following methods : - [`ReadContext getUsingLocked(@NotNull K key, @NotNull V usingValue);`] (https://github.com/OpenHFT/Chronicle-Map#off-heap-storage-and-how-using-a-proxy-object-can-improve-performance) - [`WriteContext acquireUsingLocked(@NotNull K key, @NotNull V usingValue);`] (https://github.com/OpenHFT/Chronicle-Map#acquireusinglocked) -These methods let you provide the object which the data will be written to, even if the object is -immutable. For example +These methods let you provide the object which the data will be written to, but the value use to be mutable. For example ``` java -String myString = ""; -String myResult = map.getUsing("key", myString); +CharSequence using = new StringBuilder(); +CharSequence myResult = map.getUsing("key", using); // at this point the myString and myResult will both point to the same object ``` The `map.getUsing()` method is similar to `map.get()`, but because Chronicle Map stores its data off heap, if you were to call get("key"), a new object would be created each time, map.getUsing() works -by reusing the heap memory which was used by the original Object "myString". This technique provides +by reusing the heap memory which was used by the original Object "using". This technique provides you with better control over your object creation. Exactly like `map.getUsing()`, `map.acquireUsing()` will give you back a reference to an value