Giter VIP home page Giter VIP logo

Comments (25)

Cotton-Ben avatar Cotton-Ben commented on July 1, 2024
 V getNonNullUsing(Object key, V value);     //even better?

from hugecollections-old.

Cotton-Ben avatar Cotton-Ben commented on July 1, 2024

I change me mind! I'm now familar with ...

V acquireUsing(Object key, V value);

let's keep it.

from hugecollections-old.

peter-lawrey avatar peter-lawrey commented on July 1, 2024

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.

RobAustin avatar RobAustin commented on July 1, 2024

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.

peter-lawrey avatar peter-lawrey commented on July 1, 2024

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.

Cotton-Ben avatar Cotton-Ben commented on July 1, 2024

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.

RobAustin avatar RobAustin commented on July 1, 2024

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.

peter-lawrey avatar peter-lawrey commented on July 1, 2024

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.

peter-lawrey avatar peter-lawrey commented on July 1, 2024

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.

RobAustin avatar RobAustin commented on July 1, 2024

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.

peter-lawrey avatar peter-lawrey commented on July 1, 2024

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.

RobAustin avatar RobAustin commented on July 1, 2024

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.

RobAustin avatar RobAustin commented on July 1, 2024

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.

peter-lawrey avatar peter-lawrey commented on July 1, 2024

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.

Cotton-Ben avatar Cotton-Ben commented on July 1, 2024

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.

RobAustin avatar RobAustin commented on July 1, 2024

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.

peter-lawrey avatar peter-lawrey commented on July 1, 2024

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 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 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.

RobAustin avatar RobAustin commented on July 1, 2024

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 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 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.

leventov avatar leventov commented on July 1, 2024

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.

RobAustin avatar RobAustin commented on July 1, 2024

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.

peter-lawrey avatar peter-lawrey commented on July 1, 2024

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.

leventov avatar leventov commented on July 1, 2024

getUsingOrCreate

from hugecollections-old.

Cotton-Ben avatar Cotton-Ben commented on July 1, 2024

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.

leventov avatar leventov commented on July 1, 2024

OK, you convinced me.

from hugecollections-old.

peter-lawrey avatar peter-lawrey commented on July 1, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.