switched from HashSet to LinkedHashSet where ordering of elements is

relevant, HashSet doesn't guarantee the ordering of its elements (fixes
#116)
This commit is contained in:
Martin Kurz 2013-10-08 16:02:36 +02:00
parent 9d8dfbaf26
commit 8948021500
3 changed files with 7 additions and 6 deletions

View file

@ -25,6 +25,7 @@ import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
@ -148,7 +149,7 @@ public class CopyFromHelper {
// expecting SETs or LISTs only, going default implementation of them
final Collection<T> newColl;
if (collection instanceof Set) {
newColl = new HashSet<T>();
newColl = new LinkedHashSet<T>();
} else {
newColl = new ArrayList<T>();
}

View file

@ -18,7 +18,7 @@ package com.sun.syndication.feed.synd.impl;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
@ -72,7 +72,7 @@ public class ConverterForRSS091Userland extends ConverterForRSS090 {
final List<String> creators = ((DCModule) syndFeed.getModule(DCModule.URI)).getCreators();
if (!creators.contains(author)) {
final Set<String> s = new HashSet<String>(); // using a set to
final Set<String> s = new LinkedHashSet<String>(); // using a set to
// remove
// duplicates
s.addAll(creators); // DC creators

View file

@ -17,7 +17,7 @@
package com.sun.syndication.feed.synd.impl;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
@ -52,7 +52,7 @@ public class ConverterForRSS094 extends ConverterForRSS093 {
super.copyInto(channel, syndFeed);
final List<Category> cats = channel.getCategories(); // c
if (cats.size() > 0) {
final Set<SyndCategory> s = new HashSet<SyndCategory>(); // using a
final Set<SyndCategory> s = new LinkedHashSet<SyndCategory>(); // using a
// set to
// remove
// duplicates
@ -73,7 +73,7 @@ public class ConverterForRSS094 extends ConverterForRSS093 {
if (author != null) {
final List<String> creators = ((DCModule) syndEntry.getModule(DCModule.URI)).getCreators();
if (!creators.contains(author)) {
final Set<String> s = new HashSet<String>(); // using a set to
final Set<String> s = new LinkedHashSet<String>(); // using a set to
// remove
// duplicates
s.addAll(creators); // DC creators