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:
parent
9d8dfbaf26
commit
8948021500
3 changed files with 7 additions and 6 deletions
|
@ -25,6 +25,7 @@ import java.util.Date;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
import java.util.LinkedHashSet;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
@ -148,7 +149,7 @@ public class CopyFromHelper {
|
||||||
// expecting SETs or LISTs only, going default implementation of them
|
// expecting SETs or LISTs only, going default implementation of them
|
||||||
final Collection<T> newColl;
|
final Collection<T> newColl;
|
||||||
if (collection instanceof Set) {
|
if (collection instanceof Set) {
|
||||||
newColl = new HashSet<T>();
|
newColl = new LinkedHashSet<T>();
|
||||||
} else {
|
} else {
|
||||||
newColl = new ArrayList<T>();
|
newColl = new ArrayList<T>();
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@ package com.sun.syndication.feed.synd.impl;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashSet;
|
import java.util.LinkedHashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@ public class ConverterForRSS091Userland extends ConverterForRSS090 {
|
||||||
final List<String> creators = ((DCModule) syndFeed.getModule(DCModule.URI)).getCreators();
|
final List<String> creators = ((DCModule) syndFeed.getModule(DCModule.URI)).getCreators();
|
||||||
|
|
||||||
if (!creators.contains(author)) {
|
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
|
// remove
|
||||||
// duplicates
|
// duplicates
|
||||||
s.addAll(creators); // DC creators
|
s.addAll(creators); // DC creators
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
package com.sun.syndication.feed.synd.impl;
|
package com.sun.syndication.feed.synd.impl;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashSet;
|
import java.util.LinkedHashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ public class ConverterForRSS094 extends ConverterForRSS093 {
|
||||||
super.copyInto(channel, syndFeed);
|
super.copyInto(channel, syndFeed);
|
||||||
final List<Category> cats = channel.getCategories(); // c
|
final List<Category> cats = channel.getCategories(); // c
|
||||||
if (cats.size() > 0) {
|
if (cats.size() > 0) {
|
||||||
final Set<SyndCategory> s = new HashSet<SyndCategory>(); // using a
|
final Set<SyndCategory> s = new LinkedHashSet<SyndCategory>(); // using a
|
||||||
// set to
|
// set to
|
||||||
// remove
|
// remove
|
||||||
// duplicates
|
// duplicates
|
||||||
|
@ -73,7 +73,7 @@ public class ConverterForRSS094 extends ConverterForRSS093 {
|
||||||
if (author != null) {
|
if (author != null) {
|
||||||
final List<String> creators = ((DCModule) syndEntry.getModule(DCModule.URI)).getCreators();
|
final List<String> creators = ((DCModule) syndEntry.getModule(DCModule.URI)).getCreators();
|
||||||
if (!creators.contains(author)) {
|
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
|
// remove
|
||||||
// duplicates
|
// duplicates
|
||||||
s.addAll(creators); // DC creators
|
s.addAll(creators); // DC creators
|
||||||
|
|
Loading…
Reference in a new issue