Skip to content

Commit b3052f0

Browse files
author
jan
committed
Use linkedHashMap to preserve insertion order #1336
1 parent d173d59 commit b3052f0

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

io.sloeber.autoBuild/src/io/sloeber/autoBuild/helpers/api/KeyValueTree.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,15 @@ public class KeyValueTree {
2020

2121
private String myValue;
2222
private String myKey;
23-
private Map<String, KeyValueTree> myChildren;
23+
private LinkedHashMap<String, KeyValueTree> myChildren =null;
2424
private KeyValueTree myParent;
2525

2626
public static KeyValueTree createRoot() {
2727
return new KeyValueTree((String)null,(String) null);
2828
}
2929

3030
private KeyValueTree(String newKey, String newValue) {
31-
myChildren = new TreeMap<>();
31+
myChildren = new LinkedHashMap<>();
3232
myKey = newKey;
3333
myValue = newValue;
3434
myParent = null;
@@ -45,7 +45,7 @@ public KeyValueTree(KeyValueTree source) {
4545
}
4646

4747
private KeyValueTree(KeyValueTree source, KeyValueTree parent) {
48-
myChildren = new TreeMap<>();
48+
myChildren = new LinkedHashMap<>();
4949
myKey = source.myKey;
5050
myValue = source.myValue;
5151
myParent = parent;

io.sloeber.core/src/io/sloeber/core/api/BoardDescription.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import java.util.ArrayList;
1111
import java.util.Collections;
1212
import java.util.HashMap;
13+
import java.util.HashSet;
1314
import java.util.LinkedHashMap;
1415
import java.util.LinkedHashSet;
1516
import java.util.List;
@@ -359,7 +360,7 @@ private void setDefaultOptions() {
359360

360361
private void removeInvalidMenuIDs() {
361362
Set<String> allMenuIDs = this.mySloeberBoardTxtFile.getMenus().keySet();
362-
Set<String> optionKey=myOptions.keySet();
363+
Set<String> optionKey=new HashSet<>(myOptions.keySet());
363364

364365
for ( String curOptionKey : optionKey) {
365366
if(!allMenuIDs.contains(curOptionKey)) {

0 commit comments

Comments
 (0)