0

Compared to HashMap, LinkedHashMap guarantees input order.

In Spring Batch, I think HashMap is enough to save JobParameter, but I don't know why JobParameters used LinkedHashMap. What do you think about this?

Below are some of the implementations of JobParameters. Github Link

public class JobParameters implements Serializable {

    private final Map<String,JobParameter> parameters;

    public JobParameters() {
        this.parameters = new LinkedHashMap<>();
    }

    public JobParameters(Map<String,JobParameter> parameters) {
        this.parameters = new LinkedHashMap<>(parameters);
    }

    // ...
0

1 Answer 1

0

There is no ordering between job parameters. The usage of a linked hash map is not justified in my opinion.

You can open an issue with a link to this SO thread and we will consider changing that in Spring Batch.

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.