HashMap of type <Object, ArrayList<Short>>

208 views
Skip to first unread message

mrd

unread,
Nov 30, 2012, 4:33:11 PM11/30/12
to java-high-performance...@googlegroups.com
Hello,

I am looking at HPPC for the very first time.  I am trying to replace a section of regular java code with HPPC.  The data structure I have to replace is
a java HashMap<Object, ArrayList<Short>>();  Is that possible?  I don't see an option for such a HashMap in HPPC.  

Many thanks,
Mira D

Dawid Weiss

unread,
Nov 30, 2012, 5:03:33 PM11/30/12
to java-high-performance...@googlegroups.com
You kind of can -- you can do:

ObjectObjectOpenHashMap<Object, ShortArrayList>

but this is an equivalent of:

HashMap<Object,ShortArrayList>

anyway and it'll gain you very little because there's only 2^16 Short
objects anyway and references will be probably twice the size of a
short anyway (32 bit).

If you want to store variable lists of short values associated with a
given key then I'd say you should try to build up your own data
structure where the list of short values is intelligently encoded in
one large array of shorts. This presentation may be a good start to
get the idea how to accomplish this:

http://vimeo.com/16063395

(look at how variable lists are encoded in a hierarchical structure
using backwards pointers).

If you share more light on your problem I may be able to help you in
picking a better representation.

Dawid
Reply all
Reply to author
Forward
0 new messages