How to save and retrieve data from shared preference by input order in java?

When i save such data in shared preferences 

```
 HashMap<Integer, String> likes = new HashMap<Integer, String>();

    // THIS IS INPUT ORDER

    likes.put(1,"a")
    likes.put(2,"b")
    likes.put(3,"c")
    likes.put(4,"d")
        editor = getSharedPreferences("PREFS_NAM", 0).edit();
        for (Map.Entry<Integer, String> entry : likes.entrySet())
         editor.putString(String.valueOf((entry.getKey())), 
         entry.getValue());
        editor.apply();

```

when i retrieve it 

```
SharedPreferences prefs = getSharedPreferences("PREFS_NAM", 0);
    for (Map.Entry entry : prefs.getAll().entrySet()) 
           likes.put(Integer.valueOf(entry.getKey().toString()), 
           entry.getValue().toString());

```

it looks like 

```
(1,"a")
(2,"b")
(4,"d")
(3,"c")

```

which not same input order!