tags:

views:

55

answers:

1

How can I tell Castor to use a LinkedHashMap instead of a HashMap?

A: 

A cursory glance at http://www.castor.org/reference/html-single/index.html tells me this "The type of the object inside the collection is . The 'default implementation' is the type used if the object holding the collection is found to be null and need to be instantiated."

So in your Object say

class Student {
    private Map someMap = new LinkedHashMap(); //generics ignored for clarity
}

If you initialise your field with a LinkedHashMap instead of being null. I think castor will put entries into it directly and not recreate it. Is it possible to do this with your code?

Calm Storm