#1118 Properties set in IChemObject does not guarantees order

closed
nobody
None
5
2012-10-08
2011-01-31
ycruz
No

Using CDK 1.3.7
IChemObject.setProperty(...) uses a Hashmap instead of a LinkedHashMap, Therefore , it does not guarantee that the order will remain constant over time. Can this be fixed?

Discussion

  • Rajarshi Guha
    Rajarshi Guha
    2011-01-31

    Can you elaborate why ordering is important?

     
  • ycruz
    ycruz
    2011-02-10

    I’m trying to create an sd file using CDK 1.3.7 and set some properties for a structure. However, the order of the properties is not kept. The order of the properties is important for my case. The sd that is created has a lot of properties and if the order is not kept it makes it hard for the user to read the file. Can this be fixed in a future release?

     
  • Rajarshi Guha
    Rajarshi Guha
    2011-02-12

    Hmm, this is an easy enough change, but moving to LinkedHashMap will cause a performance hit. I think it would be useful to send a mail to the list (refering to this "bug") and raise this point and see what the group thinks.

    My personal view is that it is unecessary - since one could hust get the key set and sort that. However, if for some reasons, there is a general need for in-order SD tags then we could update the code

     
  • LinkedHashMap is now used in CDK 1.3.x.