PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Tuesday, September 20, 2022

[FIXED] Why Spring batch JobParameters using LinkedHashMap

 September 20, 2022     hashmap, java, linkedhashmap, spring, spring-batch     No comments   

Issue

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);
    }

    // ...

Solution

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.



Answered By - Mahmoud Ben Hassine
Answer Checked By - Marilyn (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing