Am 25. Februar 2013 09:43 schrieb Klein, Raimund <[email protected]
>:

> To me that sounds like you can just use a List of array of double
> (List<double[]>) or, if you know the length at creation time, even just an
> array of arrays of doubles (double[][]).
>

This may not be what he wants to do. There are several problems when using
a list of arrays compared to using a map.
1. the list can contain arrays of different length. A map makes sure that
one key is associate with one value.
2. a map makes sure that keys are unique. Using a List<double[]> you would
have to iterate the hole list on every add to make sure the first array
entry is not already present.
3. Collection.contains(Object) does not work because arrays stored in the
list will be compared using equals(Object) which will compare memory
locations (instead of array contents).

Regards,
Benedikt


>
> Mit freundlichen Grüßen
>
> Raimund Klein
>
> EDV / Software Entwickler
>
>
>
> BERENBERG BANK
>
> Joh. Berenberg, Gossler & Co. KG
>
> Neuer Jungfernstieg 20
>
> 20354 Hamburg
>
>
>
> Telefon +49 40 350 60-8129
>
> Telefax +49 40 350 60-955
>
> E-Mail [email protected]
>
> www.berenberg.de
>
>
>
> Sitz: Hamburg - Amtsgericht Hamburg HRA 42659
>
> -----Ursprüngliche Nachricht-----
> Von: Osman Khalid [mailto:[email protected]]
> Gesendet: Sonntag, 24. Februar 2013 06:23
> An: Commons Users List
> Betreff: Re: Equivalent of LinkedHashMap<Double, Double> meetingEntries in
> commons primitives
>
> Thanks Daniel
>
> You are right. Trove has some functionality, but again I am stuck. As I
> want the order of insertion be preserved, but Trove's TDoubleDoubleHashMap
> does not preserve order of insertion.
>
> (I just want a pair of double, double be stored, and later i need to
> retrieve double[] from values)
>
> Regards
>
> On Sat, Feb 23, 2013 at 11:17 PM, Daniel Pitts <[email protected]
> >wrote:
>
> > First off, floating points make terrible keys. Do you really need them
> > as keys, or are you really using this as pair<double, double> ?
> >
> > I think Trove is the library you might want, not apache commons.
> >
> > Sent from my iPad
> >
> > On Feb 23, 2013, at 4:57 PM, Osman Khalid <[email protected]>
> > wrote:
> >
> > > Hi.
> > >
> > > I am using a data structure using standard java api:
> > >
> > > LinkedHashMap<Double, Double> meetingEntries;
> > >
> > > I want it to changed to primitive types as:
> > >
> > > LinkedHashMap<double, double> meetingEntries;
> > >
> > > Is it possible? What would be code for that commons primitives?
> > >
> > > I'll be really grateful for reply!
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [email protected]
> > For additional commands, e-mail: [email protected]
> >
> >
>
> Diese Nachricht einschliesslich etwa beigefuegter Anhaenge ist vertraulich
> und kann dem Bank- und Datengeheimnis unterliegen oder sonst rechtlich
> geschuetzte Daten und Informationen enthalten. Wenn Sie nicht der richtige
> Adressat sind oder diese Nachricht irrtuemlich erhalten haben, informieren
> Sie bitte sofort den Absender über die Antwortfunktion. Anschliessend
> moechten Sie bitte diese Nachricht einschliesslich etwa beigefuegter
> Anhaenge unverzueglich vollstaendig loeschen. Das unerlaubte Kopieren oder
> Speichern dieser Nachricht und/oder der ihr etwa beigefuegten Anhaenge
> sowie die unbefugte Weitergabe der darin enthaltenen Daten und
> Informationen sind nicht gestattet. Wir weisen darauf hin, dass
> rechtsverbindliche Erklaerungen namens unseres Hauses grundsaetzlich der
> Unterschriften zweier ausreichend bevollmaechtigter Vertreter unseres
> Hauses beduerfen. Wir verschicken daher keine rechtsverbindlichen
> Erklaerungen per E-Mail an Dritte. Demgemaess nehmen wir per E-Mail auch
> keine rechtsverbindlichen Erklaerungen oder Auftraege von Dritten entgegen.
> Sollten Sie Schwierigkeiten beim Oeffnen dieser E-Mail haben, wenden Sie
> sich bitte an den Absender oder an [email protected]. Please refer to
> http://www.berenberg.de/my_berenberg/disclaimer_e.html for our
> confidentiality notice.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>


-- 
http://people.apache.org/~britter/
http://www.systemoutprintln.de/
http://twitter.com/BenediktRitter
http://github.com/britter

Reply via email to