#99 - HalLinkListSerializer now generate stable link lists.

We're now using a LinkedHashMap when creating link lists.
This commit is contained in:
Eric Bottard
2013-07-16 17:21:36 +02:00
committed by Oliver Gierke
parent eed331dbe2
commit cb6dd51e04
2 changed files with 4 additions and 2 deletions

View File

@@ -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) {

View File

@@ -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>());