You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@netbeans.apache.org by Ernie Rael <er...@raelity.com> on 2020/05/20 23:06:02 UTC

OT: java map where key is in the value

Hi,

I've have a vague memory of a map implementation where the key is 
extracted from the value on a put. I thought it was Java, but I can't 
find it.

Am I hallucinating? More to the point, does anyone know of such a map. 
I'm only using a few methods, so I could make a wrapper; but I like 
using libraries...

-ernie


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@netbeans.apache.org
For additional commands, e-mail: users-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


Re: OT: java map where key is in the value

Posted by Owen Thomas <ow...@gmail.com>.
On Thu, 21 May 2020 at 12:57, Ernie Rael <er...@raelity.com> wrote:

> On 5/20/2020 7:43 PM, Owen Thomas wrote:
> > Hi Ernie.
> >
> > I have desired such an implementation; this would be a map that worked
> > a little more like a set. However, I am unaware of such a beast in the
> > Java SE API, and in this case, one just grabs the key that the object
> > generates in a put through the use of a getKey method:
> > map.put(value.getKey(),value);
>
> Yes, thanks. That's like what I do, but I feel some obligation to scatter
>
>     "assert key.equals(value.getKey())"
>
> around. With a lib, I would feel better...
>

Heheh... hmmm... yes, I understand the motivations, although that is a
little like making sure that the water you are pouring will indeed flow
down the hill.

Have a good day,

  Owen.
-- 
I'll cut your code at an intensity and from a place of my own choosing.
Clique Space(TM). Anima ex machina.

Re: OT: java map where key is in the value

Posted by Ernie Rael <er...@raelity.com>.
On 5/20/2020 7:43 PM, Owen Thomas wrote:
> Hi Ernie.
>
> I have desired such an implementation; this would be a map that worked 
> a little more like a set. However, I am unaware of such a beast in the 
> Java SE API, and in this case, one just grabs the key that the object 
> generates in a put through the use of a getKey method: 
> map.put(value.getKey(),value);

Yes, thanks. That's like what I do, but I feel some obligation to scatter

    "assert key.equals(value.getKey())"

around. With a lib, I would feel better...

>
> HTH.
>
>   Owen.
>
> On Thu, 21 May 2020 at 09:06, Ernie Rael <errael@raelity.com 
> <ma...@raelity.com>> wrote:
>
>     Hi,
>
>     I've have a vague memory of a map implementation where the key is
>     extracted from the value on a put. I thought it was Java, but I can't
>     find it.
>
>     Am I hallucinating? More to the point, does anyone know of such a
>     map.
>     I'm only using a few methods, so I could make a wrapper; but I like
>     using libraries...
>
>     -ernie
>
>
>     ---------------------------------------------------------------------
>     To unsubscribe, e-mail: users-unsubscribe@netbeans.apache.org
>     <ma...@netbeans.apache.org>
>     For additional commands, e-mail: users-help@netbeans.apache.org
>     <ma...@netbeans.apache.org>
>
>     For further information about the NetBeans mailing lists, visit:
>     https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
>
>
>
> -- 
> I'll cut your code at an intensity and from a place of my own choosing.
> Clique Space(TM). Anima ex machina.



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@netbeans.apache.org
For additional commands, e-mail: users-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


Re: OT: java map where key is in the value

Posted by Owen Thomas <ow...@gmail.com>.
Hi Ernie.

I have desired such an implementation; this would be a map that worked a
little more like a set. However, I am unaware of such a beast in the Java
SE API, and in this case, one just grabs the key that the object generates
in a put through the use of a getKey method: map.put(value.getKey(),value);

HTH.

  Owen.

On Thu, 21 May 2020 at 09:06, Ernie Rael <er...@raelity.com> wrote:

> Hi,
>
> I've have a vague memory of a map implementation where the key is
> extracted from the value on a put. I thought it was Java, but I can't
> find it.
>
> Am I hallucinating? More to the point, does anyone know of such a map.
> I'm only using a few methods, so I could make a wrapper; but I like
> using libraries...
>
> -ernie
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@netbeans.apache.org
> For additional commands, e-mail: users-help@netbeans.apache.org
>
> For further information about the NetBeans mailing lists, visit:
> https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
>
>

-- 
I'll cut your code at an intensity and from a place of my own choosing.
Clique Space(TM). Anima ex machina.