#99 - HalLinkListSerializer now generate stable link lists.
We're now using a LinkedHashMap when creating link lists.
This commit is contained in:
committed by
Oliver Gierke
parent
eed331dbe2
commit
cb6dd51e04
@@ -20,6 +20,7 @@ import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -115,7 +116,7 @@ public class Jackson1HalModule extends SimpleModule {
|
||||
JsonGenerationException {
|
||||
|
||||
// sort links according to their relation
|
||||
Map<String, List<Link>> sortedLinks = new HashMap<String, List<Link>>();
|
||||
Map<String, List<Link>> sortedLinks = new LinkedHashMap<String, List<Link>>();
|
||||
|
||||
for (Link link : value) {
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -112,7 +113,7 @@ public class Jackson2HalModule extends SimpleModule {
|
||||
JsonGenerationException {
|
||||
|
||||
// sort links according to their relation
|
||||
Map<String, List<Link>> sortedLinks = new HashMap<String, List<Link>>();
|
||||
Map<String, List<Link>> sortedLinks = new LinkedHashMap<String, List<Link>>();
|
||||
for (Link link : value) {
|
||||
if (sortedLinks.get(link.getRel()) == null) {
|
||||
sortedLinks.put(link.getRel(), new ArrayList<Link>());
|
||||
|
||||
Reference in New Issue
Block a user