You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@thrift.apache.org by Dheeraj Goswami <dh...@yahoo.com> on 2011/02/01 03:19:20 UTC
Ordered Map in Thrift
Hi,I have the requirement to use Map but keep it ordered (Like LinkedHashMap in java). Is there a way to define thrift IDL to generate the ordered map in Java and C++ languages?
thanks,
--dheeraj
RE: Ordered Map in Thrift
Posted by Mark Slee <ms...@fb.com>.
This doesn't exist as a Thrift feature. You'll need to separately maintain a list to preserve ordering using Thrift off-the-shelf.
Another route to take would be to use some of the annotations to tell Thrift what data-types to use for the map type. If you provide container types that implement ordering, they can be swapped out. I don't recall off the top of my head what the syntax is on these type annotations or how deep the support is -- perhaps someone else can chime in there, or you might look through the implementation.
-----Original Message-----
From: Dheeraj Goswami [mailto:dheerajgoswami@yahoo.com]
Sent: Monday, January 31, 2011 6:19 PM
To: user@thrift.apache.org
Subject: Ordered Map in Thrift
Hi,I have the requirement to use Map but keep it ordered (Like LinkedHashMap in java). Is there a way to define thrift IDL to generate the ordered map in Java and C++ languages?
thanks,
--dheeraj