Comments (25)
V getNonNullUsing(Object key, V value); //even better?
from hugecollections-old.
I change me mind! I'm now familar with ...
V acquireUsing(Object key, V value);
let's keep it.
from hugecollections-old.
While not universally in computing, it think it is clear enough. I have
seen "acquire" used quite a few time.
http://www.oxforddictionaries.com/definition/english/acquire
"acquire [verb] buy or obtain (an asset or object) for oneself."
For me,
newXxxx => create a new thing always
getXxxx => get if present.
acquireXxxx => get if present or create if not.
On 5 March 2014 04:59, Ben Cotton [email protected] wrote:
Do you think it might be a little clearer if the
V acquireUsing(Object key, V value);
signature was changed to
V getOrCreate(Object key, V value); //makes it more obvious non-NULL will be returned.
or possibly
V getNonNull(Object key, V value); //makes it totally obvious non-NULL will be returned.
?
Keeping the current signature is fine, of course, I'm just saying for (
simple minded ) me the last one makes it easier to remember which signature
can't return NULL. ;-)Reply to this email directly or view it on GitHubhttps://github.com//issues/14
.
from hugecollections-old.
I was struggling to understand what acquireUsing() does, for me getOrCreate() is much clearer.
Rob
On 4 Mar 2014, at 19:55, Peter Lawrey [email protected] wrote:
While not universally in computing, it think it is clear enough. I have
seen "acquire" used quite a few time.http://www.oxforddictionaries.com/definition/english/acquire
"acquire [verb] buy or obtain (an asset or object) for oneself."
For me,
newXxxx => create a new thing always
getXxxx => get if present.
acquireXxxx => get if present or create if not.On 5 March 2014 04:59, Ben Cotton [email protected] wrote:
Do you think it might be a little clearer if the
V acquireUsing(Object key, V value);
signature was changed to
V getOrCreate(Object key, V value); //makes it more obvious non-NULL will be returned.
or possibly
V getNonNull(Object key, V value); //makes it totally obvious non-NULL will be returned.
?
Keeping the current signature is fine, of course, I'm just saying for (
simple minded ) me the last one makes it easier to remember which signature
can't return NULL. ;-)Reply to this email directly or view it on GitHubhttps://github.com//issues/14
.—
Reply to this email directly or view it on GitHub.
from hugecollections-old.
The problem is that it doesn't strictly create anything either.
acquireUsing doesn't create any objects when used correctly, it is more
like assigned-to-existing-record-or-allocate-a-new-record-and-assign-it.
On 5 March 2014 06:59, Rob Austin [email protected] wrote:
I was struggling to understand what acquireUsing() does, for me
getOrCreate() is much clearer.Rob
On 4 Mar 2014, at 19:55, Peter Lawrey [email protected] wrote:
While not universally in computing, it think it is clear enough. I have
seen "acquire" used quite a few time.http://www.oxforddictionaries.com/definition/english/acquire
"acquire [verb] buy or obtain (an asset or object) for oneself."
For me,
newXxxx => create a new thing always
getXxxx => get if present.
acquireXxxx => get if present or create if not.On 5 March 2014 04:59, Ben Cotton [email protected] wrote:
Do you think it might be a little clearer if the
V acquireUsing(Object key, V value);
signature was changed to
V getOrCreate(Object key, V value); //makes it more obvious non-NULL
will be returned.or possibly
V getNonNull(Object key, V value); //makes it totally obvious non-NULL
will be returned.?
Keeping the current signature is fine, of course, I'm just saying for
(
simple minded ) me the last one makes it easier to remember which
signature
can't return NULL. ;-)Reply to this email directly or view it on GitHub<
https://github.com/OpenHFT/HugeCollections/issues/14>
.Reply to this email directly or view it on GitHub.
Reply to this email directly or view it on GitHubhttps://github.com//issues/14#issuecomment-36667028
.
from hugecollections-old.
I thought so too at first, but on second thought ... 'acquire' feels
more regal.
On 03/04/2014 02:59 PM, Rob Austin wrote:
I was struggling to understand what acquireUsing() does, for me
getOrCreate() is much clearer.Rob
On 4 Mar 2014, at 19:55, Peter Lawrey [email protected] wrote:
While not universally in computing, it think it is clear enough. I have
seen "acquire" used quite a few time.http://www.oxforddictionaries.com/definition/english/acquire
"acquire [verb] buy or obtain (an asset or object) for oneself."
For me,
newXxxx => create a new thing always
getXxxx => get if present.
acquireXxxx => get if present or create if not.On 5 March 2014 04:59, Ben Cotton [email protected] wrote:
Do you think it might be a little clearer if the
V acquireUsing(Object key, V value);
signature was changed to
V getOrCreate(Object key, V value); //makes it more obvious
non-NULL will be returned.or possibly
V getNonNull(Object key, V value); //makes it totally obvious
non-NULL will be returned.?
Keeping the current signature is fine, of course, I'm just saying
for (
simple minded ) me the last one makes it easier to remember which
signature
can't return NULL. ;-)Reply to this email directly or view it on
GitHubhttps://github.com//issues/14
.—
Reply to this email directly or view it on GitHub.—
Reply to this email directly or view it on GitHub
#14 (comment).
from hugecollections-old.
Some good java doc will help, Peter if you email me an explanation, I’ll add it to the code.
Rob
On 4 Mar 2014, at 20:08, Ben Cotton [email protected] wrote:
I thought so too at first, but on second thought ... 'acquire' feels
more regal.On 03/04/2014 02:59 PM, Rob Austin wrote:
I was struggling to understand what acquireUsing() does, for me
getOrCreate() is much clearer.Rob
On 4 Mar 2014, at 19:55, Peter Lawrey [email protected] wrote:
While not universally in computing, it think it is clear enough. I have
seen "acquire" used quite a few time.http://www.oxforddictionaries.com/definition/english/acquire
"acquire [verb] buy or obtain (an asset or object) for oneself."
For me,
newXxxx => create a new thing always
getXxxx => get if present.
acquireXxxx => get if present or create if not.On 5 March 2014 04:59, Ben Cotton [email protected] wrote:
Do you think it might be a little clearer if the
V acquireUsing(Object key, V value);
signature was changed to
V getOrCreate(Object key, V value); //makes it more obvious
non-NULL will be returned.or possibly
V getNonNull(Object key, V value); //makes it totally obvious
non-NULL will be returned.?
Keeping the current signature is fine, of course, I'm just saying
for (
simple minded ) me the last one makes it easier to remember which
signature
can't return NULL. ;-)Reply to this email directly or view it on
GitHubhttps://github.com//issues/14
.—
Reply to this email directly or view it on GitHub.—
Reply to this email directly or view it on GitHub
#14 (comment).—
Reply to this email directly or view it on GitHub.
from hugecollections-old.
What you could do is treat remove(K, V) as replace(K,V, null) where the
replaced value of null implies a delete.
On 5 March 2014 07:07, Peter Lawrey [email protected] wrote:
The problem is that it doesn't strictly create anything either.
acquireUsing doesn't create any objects when used correctly, it is more
like assigned-to-existing-record-or-allocate-a-new-record-and-assign-it.On 5 March 2014 06:59, Rob Austin [email protected] wrote:
I was struggling to understand what acquireUsing() does, for me
getOrCreate() is much clearer.Rob
On 4 Mar 2014, at 19:55, Peter Lawrey [email protected] wrote:
While not universally in computing, it think it is clear enough. I have
seen "acquire" used quite a few time.http://www.oxforddictionaries.com/definition/english/acquire
"acquire [verb] buy or obtain (an asset or object) for oneself."
For me,
newXxxx => create a new thing always
getXxxx => get if present.
acquireXxxx => get if present or create if not.On 5 March 2014 04:59, Ben Cotton [email protected] wrote:
Do you think it might be a little clearer if the
V acquireUsing(Object key, V value);
signature was changed to
V getOrCreate(Object key, V value); //makes it more obvious non-NULL
will be returned.or possibly
V getNonNull(Object key, V value); //makes it totally obvious
non-NULL will be returned.?
Keeping the current signature is fine, of course, I'm just saying for
(
simple minded ) me the last one makes it easier to remember which
signature
can't return NULL. ;-)Reply to this email directly or view it on GitHub<
https://github.com/OpenHFT/HugeCollections/issues/14>
.Reply to this email directly or view it on GitHub.
Reply to this email directly or view it on GitHubhttps://github.com//issues/14#issuecomment-36667028
.
from hugecollections-old.
Do you think it makes sense to have a replaceReturnsNull(true) flag?
On 5 March 2014 10:00, Peter Lawrey [email protected] wrote:
What you could do is treat remove(K, V) as replace(K,V, null) where the
replaced value of null implies a delete.On 5 March 2014 07:07, Peter Lawrey [email protected] wrote:
The problem is that it doesn't strictly create anything either.
acquireUsing doesn't create any objects when used correctly, it is more
like assigned-to-existing-record-or-allocate-a-new-record-and-assign-it.On 5 March 2014 06:59, Rob Austin [email protected] wrote:
I was struggling to understand what acquireUsing() does, for me
getOrCreate() is much clearer.Rob
On 4 Mar 2014, at 19:55, Peter Lawrey [email protected] wrote:
While not universally in computing, it think it is clear enough. I
have
seen "acquire" used quite a few time.http://www.oxforddictionaries.com/definition/english/acquire
"acquire [verb] buy or obtain (an asset or object) for oneself."
For me,
newXxxx => create a new thing always
getXxxx => get if present.
acquireXxxx => get if present or create if not.On 5 March 2014 04:59, Ben Cotton [email protected] wrote:
Do you think it might be a little clearer if the
V acquireUsing(Object key, V value);
signature was changed to
V getOrCreate(Object key, V value); //makes it more obvious non-NULL
will be returned.or possibly
V getNonNull(Object key, V value); //makes it totally obvious
non-NULL will be returned.?
Keeping the current signature is fine, of course, I'm just saying
for (
simple minded ) me the last one makes it easier to remember which
signature
can't return NULL. ;-)Reply to this email directly or view it on GitHub<
https://github.com/OpenHFT/HugeCollections/issues/14>
.Reply to this email directly or view it on GitHub.
Reply to this email directly or view it on GitHubhttps://github.com//issues/14#issuecomment-36667028
.
from hugecollections-old.
Ok
Sent from my iPad
On 4 Mar 2014, at 23:00, Peter Lawrey [email protected] wrote:
What you could do is treat remove(K, V) as replace(K,V, null) where the
replaced value of null implies a delete.On 5 March 2014 07:07, Peter Lawrey [email protected] wrote:
The problem is that it doesn't strictly create anything either.
acquireUsing doesn't create any objects when used correctly, it is more
like assigned-to-existing-record-or-allocate-a-new-record-and-assign-it.On 5 March 2014 06:59, Rob Austin [email protected] wrote:
I was struggling to understand what acquireUsing() does, for me
getOrCreate() is much clearer.Rob
On 4 Mar 2014, at 19:55, Peter Lawrey [email protected] wrote:
While not universally in computing, it think it is clear enough. I have
seen "acquire" used quite a few time.http://www.oxforddictionaries.com/definition/english/acquire
"acquire [verb] buy or obtain (an asset or object) for oneself."
For me,
newXxxx => create a new thing always
getXxxx => get if present.
acquireXxxx => get if present or create if not.On 5 March 2014 04:59, Ben Cotton [email protected] wrote:
Do you think it might be a little clearer if the
V acquireUsing(Object key, V value);
signature was changed to
V getOrCreate(Object key, V value); //makes it more obvious non-NULL
will be returned.or possibly
V getNonNull(Object key, V value); //makes it totally obvious
non-NULL will be returned.?
Keeping the current signature is fine, of course, I'm just saying for
(
simple minded ) me the last one makes it easier to remember which
signature
can't return NULL. ;-)Reply to this email directly or view it on GitHub<
https://github.com/OpenHFT/HugeCollections/issues/14>
.Reply to this email directly or view it on GitHub.
Reply to this email directly or view it on GitHubhttps://github.com//issues/14#issuecomment-36667028
.—
Reply to this email directly or view it on GitHub.
from hugecollections-old.
Could you do a review of the methods implemented by AbstractMap to see
which ones we might want to override?
On 5 March 2014 10:01, Peter Lawrey [email protected] wrote:
Do you think it makes sense to have a replaceReturnsNull(true) flag?
On 5 March 2014 10:00, Peter Lawrey [email protected] wrote:
What you could do is treat remove(K, V) as replace(K,V, null) where the
replaced value of null implies a delete.On 5 March 2014 07:07, Peter Lawrey [email protected] wrote:
The problem is that it doesn't strictly create anything either.
acquireUsing doesn't create any objects when used correctly, it is more
like assigned-to-existing-record-or-allocate-a-new-record-and-assign-it.On 5 March 2014 06:59, Rob Austin [email protected] wrote:
I was struggling to understand what acquireUsing() does, for me
getOrCreate() is much clearer.Rob
On 4 Mar 2014, at 19:55, Peter Lawrey [email protected]
wrote:While not universally in computing, it think it is clear enough. I
have
seen "acquire" used quite a few time.http://www.oxforddictionaries.com/definition/english/acquire
"acquire [verb] buy or obtain (an asset or object) for oneself."
For me,
newXxxx => create a new thing always
getXxxx => get if present.
acquireXxxx => get if present or create if not.On 5 March 2014 04:59, Ben Cotton [email protected] wrote:
Do you think it might be a little clearer if the
V acquireUsing(Object key, V value);
signature was changed to
V getOrCreate(Object key, V value); //makes it more obvious
non-NULL will be returned.or possibly
V getNonNull(Object key, V value); //makes it totally obvious
non-NULL will be returned.?
Keeping the current signature is fine, of course, I'm just saying
for (
simple minded ) me the last one makes it easier to remember which
signature
can't return NULL. ;-)Reply to this email directly or view it on GitHub<
https://github.com/OpenHFT/HugeCollections/issues/14>
.Reply to this email directly or view it on GitHub.
Reply to this email directly or view it on GitHubhttps://github.com//issues/14#issuecomment-36667028
.
from hugecollections-old.
No - as before you do the replace you have to read() to see if a value exists so you do the read anyway.
Sent from my iPad
On 4 Mar 2014, at 23:01, Peter Lawrey [email protected] wrote:
Do you think it makes sense to have a replaceReturnsNull(true) flag?
On 5 March 2014 10:00, Peter Lawrey [email protected] wrote:
What you could do is treat remove(K, V) as replace(K,V, null) where the
replaced value of null implies a delete.On 5 March 2014 07:07, Peter Lawrey [email protected] wrote:
The problem is that it doesn't strictly create anything either.
acquireUsing doesn't create any objects when used correctly, it is more
like assigned-to-existing-record-or-allocate-a-new-record-and-assign-it.On 5 March 2014 06:59, Rob Austin [email protected] wrote:
I was struggling to understand what acquireUsing() does, for me
getOrCreate() is much clearer.Rob
On 4 Mar 2014, at 19:55, Peter Lawrey [email protected] wrote:
While not universally in computing, it think it is clear enough. I
have
seen "acquire" used quite a few time.http://www.oxforddictionaries.com/definition/english/acquire
"acquire [verb] buy or obtain (an asset or object) for oneself."
For me,
newXxxx => create a new thing always
getXxxx => get if present.
acquireXxxx => get if present or create if not.On 5 March 2014 04:59, Ben Cotton [email protected] wrote:
Do you think it might be a little clearer if the
V acquireUsing(Object key, V value);
signature was changed to
V getOrCreate(Object key, V value); //makes it more obvious non-NULL
will be returned.or possibly
V getNonNull(Object key, V value); //makes it totally obvious
non-NULL will be returned.?
Keeping the current signature is fine, of course, I'm just saying
for (
simple minded ) me the last one makes it easier to remember which
signature
can't return NULL. ;-)Reply to this email directly or view it on GitHub<
https://github.com/OpenHFT/HugeCollections/issues/14>
.Reply to this email directly or view it on GitHub.
Reply to this email directly or view it on GitHubhttps://github.com//issues/14#issuecomment-36667028
.—
Reply to this email directly or view it on GitHub.
from hugecollections-old.
Sure - I'll raise some Jira's.
Sent from my iPad
On 4 Mar 2014, at 23:02, Peter Lawrey [email protected] wrote:
Could you do a review of the methods implemented by AbstractMap to see
which ones we might want to override?On 5 March 2014 10:01, Peter Lawrey [email protected] wrote:
Do you think it makes sense to have a replaceReturnsNull(true) flag?
On 5 March 2014 10:00, Peter Lawrey [email protected] wrote:
What you could do is treat remove(K, V) as replace(K,V, null) where the
replaced value of null implies a delete.On 5 March 2014 07:07, Peter Lawrey [email protected] wrote:
The problem is that it doesn't strictly create anything either.
acquireUsing doesn't create any objects when used correctly, it is more
like assigned-to-existing-record-or-allocate-a-new-record-and-assign-it.On 5 March 2014 06:59, Rob Austin [email protected] wrote:
I was struggling to understand what acquireUsing() does, for me
getOrCreate() is much clearer.Rob
On 4 Mar 2014, at 19:55, Peter Lawrey [email protected]
wrote:While not universally in computing, it think it is clear enough. I
have
seen "acquire" used quite a few time.http://www.oxforddictionaries.com/definition/english/acquire
"acquire [verb] buy or obtain (an asset or object) for oneself."
For me,
newXxxx => create a new thing always
getXxxx => get if present.
acquireXxxx => get if present or create if not.On 5 March 2014 04:59, Ben Cotton [email protected] wrote:
Do you think it might be a little clearer if the
V acquireUsing(Object key, V value);
signature was changed to
V getOrCreate(Object key, V value); //makes it more obvious
non-NULL will be returned.or possibly
V getNonNull(Object key, V value); //makes it totally obvious
non-NULL will be returned.?
Keeping the current signature is fine, of course, I'm just saying
for (
simple minded ) me the last one makes it easier to remember which
signature
can't return NULL. ;-)Reply to this email directly or view it on GitHub<
https://github.com/OpenHFT/HugeCollections/issues/14>
.Reply to this email directly or view it on GitHub.
Reply to this email directly or view it on GitHubhttps://github.com//issues/14#issuecomment-36667028
.—
Reply to this email directly or view it on GitHub.
from hugecollections-old.
Just for the record, acquireUsing, doesn't create any objects or use any
extra memory unless you pass null.
On 5 March 2014 07:07, Peter Lawrey [email protected] wrote:
The problem is that it doesn't strictly create anything either.
acquireUsing doesn't create any objects when used correctly, it is more
like assigned-to-existing-record-or-allocate-a-new-record-and-assign-it.On 5 March 2014 06:59, Rob Austin [email protected] wrote:
I was struggling to understand what acquireUsing() does, for me
getOrCreate() is much clearer.Rob
On 4 Mar 2014, at 19:55, Peter Lawrey [email protected] wrote:
While not universally in computing, it think it is clear enough. I have
seen "acquire" used quite a few time.http://www.oxforddictionaries.com/definition/english/acquire
"acquire [verb] buy or obtain (an asset or object) for oneself."
For me,
newXxxx => create a new thing always
getXxxx => get if present.
acquireXxxx => get if present or create if not.On 5 March 2014 04:59, Ben Cotton [email protected] wrote:
Do you think it might be a little clearer if the
V acquireUsing(Object key, V value);
signature was changed to
V getOrCreate(Object key, V value); //makes it more obvious non-NULL
will be returned.or possibly
V getNonNull(Object key, V value); //makes it totally obvious
non-NULL will be returned.?
Keeping the current signature is fine, of course, I'm just saying for
(
simple minded ) me the last one makes it easier to remember which
signature
can't return NULL. ;-)Reply to this email directly or view it on GitHub<
https://github.com/OpenHFT/HugeCollections/issues/14>
.Reply to this email directly or view it on GitHub.
Reply to this email directly or view it on GitHubhttps://github.com//issues/14#issuecomment-36667028
.
from hugecollections-old.
Absolutely. I can see it being empowering ....
Sent from my iPhone
On Mar 4, 2014, at 6:01 PM, Peter Lawrey [email protected] wrote:
Do you think it makes sense to have a replaceReturnsNull(true) flag?
On 5 March 2014 10:00, Peter Lawrey [email protected] wrote:
What you could do is treat remove(K, V) as replace(K,V, null) where the
replaced value of null implies a delete.On 5 March 2014 07:07, Peter Lawrey [email protected] wrote:
The problem is that it doesn't strictly create anything either.
acquireUsing doesn't create any objects when used correctly, it is more
like assigned-to-existing-record-or-allocate-a-new-record-and-assign-it.On 5 March 2014 06:59, Rob Austin [email protected] wrote:
I was struggling to understand what acquireUsing() does, for me
getOrCreate() is much clearer.Rob
On 4 Mar 2014, at 19:55, Peter Lawrey [email protected] wrote:
While not universally in computing, it think it is clear enough. I
have
seen "acquire" used quite a few time.http://www.oxforddictionaries.com/definition/english/acquire
"acquire [verb] buy or obtain (an asset or object) for oneself."
For me,
newXxxx => create a new thing always
getXxxx => get if present.
acquireXxxx => get if present or create if not.On 5 March 2014 04:59, Ben Cotton [email protected] wrote:
Do you think it might be a little clearer if the
V acquireUsing(Object key, V value);
signature was changed to
V getOrCreate(Object key, V value); //makes it more obvious non-NULL
will be returned.or possibly
V getNonNull(Object key, V value); //makes it totally obvious
non-NULL will be returned.?
Keeping the current signature is fine, of course, I'm just saying
for (
simple minded ) me the last one makes it easier to remember which
signature
can't return NULL. ;-)Reply to this email directly or view it on GitHub<
https://github.com/OpenHFT/HugeCollections/issues/14>
.Reply to this email directly or view it on GitHub.
Reply to this email directly or view it on GitHubhttps://github.com//issues/14#issuecomment-36667028
.—
Reply to this email directly or view it on GitHub.
from hugecollections-old.
These methods although similar, are not identical, I will refactor out the commonalities though
Sent from my iPad
On 4 Mar 2014, at 23:00, Peter Lawrey [email protected] wrote:
What you could do is treat remove(K, V) as replace(K,V, null) where the
replaced value of null implies a delete.On 5 March 2014 07:07, Peter Lawrey [email protected] wrote:
The problem is that it doesn't strictly create anything either.
acquireUsing doesn't create any objects when used correctly, it is more
like assigned-to-existing-record-or-allocate-a-new-record-and-assign-it.On 5 March 2014 06:59, Rob Austin [email protected] wrote:
I was struggling to understand what acquireUsing() does, for me
getOrCreate() is much clearer.Rob
On 4 Mar 2014, at 19:55, Peter Lawrey [email protected] wrote:
While not universally in computing, it think it is clear enough. I have
seen "acquire" used quite a few time.http://www.oxforddictionaries.com/definition/english/acquire
"acquire [verb] buy or obtain (an asset or object) for oneself."
For me,
newXxxx => create a new thing always
getXxxx => get if present.
acquireXxxx => get if present or create if not.On 5 March 2014 04:59, Ben Cotton [email protected] wrote:
Do you think it might be a little clearer if the
V acquireUsing(Object key, V value);
signature was changed to
V getOrCreate(Object key, V value); //makes it more obvious non-NULL
will be returned.or possibly
V getNonNull(Object key, V value); //makes it totally obvious
non-NULL will be returned.?
Keeping the current signature is fine, of course, I'm just saying for
(
simple minded ) me the last one makes it easier to remember which
signature
can't return NULL. ;-)Reply to this email directly or view it on GitHub<
https://github.com/OpenHFT/HugeCollections/issues/14>
.Reply to this email directly or view it on GitHub.
Reply to this email directly or view it on GitHubhttps://github.com//issues/14#issuecomment-36667028
.—
Reply to this email directly or view it on GitHub.
from hugecollections-old.
Refactoring is a nice to have for the alpha release, we should go back and
refactor for the beta release.
On 5 March 2014 10:10, Rob Austin [email protected] wrote:
These methods although similar, are not identical, I will refactor out the
commonalities thoughSent from my iPad
On 4 Mar 2014, at 23:00, Peter Lawrey [email protected] wrote:
What you could do is treat remove(K, V) as replace(K,V, null) where the
replaced value of null implies a delete.On 5 March 2014 07:07, Peter Lawrey [email protected] wrote:
The problem is that it doesn't strictly create anything either.
acquireUsing doesn't create any objects when used correctly, it is
more
like
assigned-to-existing-record-or-allocate-a-new-record-and-assign-it.On 5 March 2014 06:59, Rob Austin [email protected] wrote:
I was struggling to understand what acquireUsing() does, for me
getOrCreate() is much clearer.Rob
On 4 Mar 2014, at 19:55, Peter Lawrey [email protected]
wrote:While not universally in computing, it think it is clear enough. I
have
seen "acquire" used quite a few time.http://www.oxforddictionaries.com/definition/english/acquire
"acquire [verb] buy or obtain (an asset or object) for oneself."
For me,
newXxxx => create a new thing always
getXxxx => get if present.
acquireXxxx => get if present or create if not.On 5 March 2014 04:59, Ben Cotton [email protected]
wrote:Do you think it might be a little clearer if the
V acquireUsing(Object key, V value);
signature was changed to
V getOrCreate(Object key, V value); //makes it more obvious
non-NULL
will be returned.or possibly
V getNonNull(Object key, V value); //makes it totally obvious
non-NULL will be returned.?
Keeping the current signature is fine, of course, I'm just saying
for
(
simple minded ) me the last one makes it easier to remember which
signature
can't return NULL. ;-)Reply to this email directly or view it on GitHub<
https://github.com/OpenHFT/HugeCollections/issues/14>
.Reply to this email directly or view it on GitHub.
Reply to this email directly or view it on GitHub<
https://github.com/OpenHFT/HugeCollections/issues/14#issuecomment-36667028>.
Reply to this email directly or view it on GitHub.
Reply to this email directly or view it on GitHubhttps://github.com//issues/14#issuecomment-36690859
.
from hugecollections-old.
Ok - I'll focus on more important tasks for the moment.
Sent from my iPad
On 4 Mar 2014, at 23:11, Peter Lawrey [email protected] wrote:
Refactoring is a nice to have for the alpha release, we should go back and
refactor for the beta release.On 5 March 2014 10:10, Rob Austin [email protected] wrote:
These methods although similar, are not identical, I will refactor out the
commonalities thoughSent from my iPad
On 4 Mar 2014, at 23:00, Peter Lawrey [email protected] wrote:
What you could do is treat remove(K, V) as replace(K,V, null) where the
replaced value of null implies a delete.On 5 March 2014 07:07, Peter Lawrey [email protected] wrote:
The problem is that it doesn't strictly create anything either.
acquireUsing doesn't create any objects when used correctly, it is
more
like
assigned-to-existing-record-or-allocate-a-new-record-and-assign-it.On 5 March 2014 06:59, Rob Austin [email protected] wrote:
I was struggling to understand what acquireUsing() does, for me
getOrCreate() is much clearer.Rob
On 4 Mar 2014, at 19:55, Peter Lawrey [email protected]
wrote:While not universally in computing, it think it is clear enough. I
have
seen "acquire" used quite a few time.http://www.oxforddictionaries.com/definition/english/acquire
"acquire [verb] buy or obtain (an asset or object) for oneself."
For me,
newXxxx => create a new thing always
getXxxx => get if present.
acquireXxxx => get if present or create if not.On 5 March 2014 04:59, Ben Cotton [email protected]
wrote:Do you think it might be a little clearer if the
V acquireUsing(Object key, V value);
signature was changed to
V getOrCreate(Object key, V value); //makes it more obvious
non-NULL
will be returned.or possibly
V getNonNull(Object key, V value); //makes it totally obvious
non-NULL will be returned.?
Keeping the current signature is fine, of course, I'm just saying
for
(
simple minded ) me the last one makes it easier to remember which
signature
can't return NULL. ;-)Reply to this email directly or view it on GitHub<
https://github.com/OpenHFT/HugeCollections/issues/14>
.Reply to this email directly or view it on GitHub.
Reply to this email directly or view it on GitHub<
https://github.com/OpenHFT/HugeCollections/issues/14#issuecomment-36667028>.
Reply to this email directly or view it on GitHub.
Reply to this email directly or view it on GitHubhttps://github.com//issues/14#issuecomment-36690859
.—
Reply to this email directly or view it on GitHub.
from hugecollections-old.
Don't forget about IDE autocomplete. If I forget acquireUsing
method name (that's easy), I want to type "map.get", then Ctrl+Enter to see all kinds of get
available. Simple get
creates an object as well in sense we mean when consider getOrCreate
name for acquireUsing
, thus I'd suggest getOrReuse
.
from hugecollections-old.
I agree
On 5 Mar 2014, at 04:30, Roman Leventov [email protected] wrote:
Don't forget about IDE autocomplete. If I forget acquireUsing method name (that's easy), I want to type "map.get", then Ctrl+Enter to see all kinds of get available. Simple get creates an object as well in sense we mean when consider getOrCreate name for acquireUsing, thus I'd suggest getOrReuse.
—
Reply to this email directly or view it on GitHub.
from hugecollections-old.
getUsing will always reuse, not "get OR reuse". acquireUsing will also
always reuse. The difference is that acquire will never return null.
On 5 March 2014 17:59, Rob Austin [email protected] wrote:
I agree
On 5 Mar 2014, at 04:30, Roman Leventov [email protected] wrote:
Don't forget about IDE autocomplete. If I forget acquireUsing method
name (that's easy), I want to type "map.get", then Ctrl+Enter to see all
kinds of get available. Simple get creates an object as well in sense we
mean when consider getOrCreate name for acquireUsing, thus I'd suggest
getOrReuse.Reply to this email directly or view it on GitHub.
Reply to this email directly or view it on GitHubhttps://github.com//issues/14#issuecomment-36715393
.
from hugecollections-old.
getUsingOrCreate
from hugecollections-old.
We also initially felt awkward with the choice "acquireUsing" ... but
that awkwardness truly wore off (and in very little time). We made the
gentle effort= "let us try to adapt to its name" rather than "let it
adapt to our name". For us it worked. "acquire' is a richer, more
regal verb. As Peter points out, it overloads in-place full
"getOrCreate" semantics (without the need of a literal in-order binary
conjunctive). It took all of a 2 minutes of our practicing "you can
'get' a NULL" but you can't "acquire" a NULL. By the third minute, we
were in love with "acquireUsing" ... so much so that we closed #13.
On 3/5/2014 6:21 AM, Peter Lawrey wrote:
getUsing will always reuse, not "get OR reuse". acquireUsing will also
always reuse. The difference is that acquire will never return null.On 5 March 2014 17:59, Rob Austin [email protected] wrote:
I agree
On 5 Mar 2014, at 04:30, Roman Leventov [email protected]
wrote:Don't forget about IDE autocomplete. If I forget acquireUsing method
name (that's easy), I want to type "map.get", then Ctrl+Enter to see all
kinds of get available. Simple get creates an object as well in sense we
mean when consider getOrCreate name for acquireUsing, thus I'd suggest
getOrReuse.Reply to this email directly or view it on GitHub.
Reply to this email directly or view it on
GitHubhttps://github.com//issues/14#issuecomment-36715393
.—
Reply to this email directly or view it on GitHub
#14 (comment).
from hugecollections-old.
OK, you convinced me.
from hugecollections-old.
get() creates an object.
acquireUsing(key, non-null) and getUsing(key, non-null) never create an
object or use more memory.
I think it would be confusing to put "Create" on the method which doesn't
create, while the method called just get() does create.
On 5 March 2014 22:26, Roman Leventov [email protected] wrote:
getUsingOrCreate
Reply to this email directly or view it on GitHubhttps://github.com//issues/14#issuecomment-36733094
.
from hugecollections-old.
Related Issues (20)
- setSegments(int) is not public in HugeConfig; cannot be accessed from outside package HOT 3
- Comparing behaviour of HugeHashMap with HashMap HOT 2
- custom marshalling/serialization HOT 16
- remark on replication/distribution HOT 9
- how to get exactly 1 OpenHFT test to run HOT 10
- Using Shared/HugeHashMap HOT 3
- PingPong latency test across /dev/shm/SharedHashMap IPC ... HOT 19
- support for "read through" and "write behind" gettr/settrs (in addition to JBI) HOT 25
- Cache size exceed bug HOT 1
- TCPSocketReplication4WayMapTest testBufferOverflow failed (Windows 8.1) HOT 10
- VanillaShortShortMultiMap is full when capacity is still available HOT 5
- Difference between setSmallEntrySize and setCapacity
- SharedHashMap: iterating using keyset, valueset is very slow for larger tables HOT 8
- problem using SharedHashMapBuilder ... HOT 6
- OpenHFT scope of capability re: SHMEntry fields (user JBI supplied) and "barrier" operations HOT 9
- HugeHashMap with JPA elements HOT 4
- SharedHashMap causing crash on Windows OS HOT 28
- Chronicle Map not thread-safe in certain circumstances HOT 14
- ChronicleMap / ChronicleMapBuilder - actualEntriesPerSegment restricted to minimum of 8 HOT 13
- too many Segment.getKey() invocations HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hugecollections-old.