mvel
mvel copied to clipboard
Maintain order when using inline maps and lists
First of all, awesome tool. I just recently starting messing around with MVEL.
I sent an email to the user mailing list this morning regarding the possibility of switching the parser's Map implementation from HashMap to LinkedHashMap so that the order of keys are maintained based on insertion.
My primary use case this functionality was so that I could have a nice syntax to build maps for a JSON serializer. For REST APIs, I prefer when the JSON keys are ordered in a predictable way and are consistent with API documentation.
This pull request has what I think are the necessary changes, and it includes a test that confirms the order works (test would break if HashMap implementation was kept).