return 1;
}
- String id = (getUuid() == null ? "" : getUuid())
+ String id = (getTitle() == null ? "" : getTitle())
+ + (getUuid() == null ? "" : getUuid())
+ (getLuid() == null ? "" : getLuid());
- String oId = (getUuid() == null ? "" : o.getUuid())
+ String oId = (getTitle() == null ? "" : o.getTitle())
+ + (getUuid() == null ? "" : o.getUuid())
+ (o.getLuid() == null ? "" : o.getLuid());
- return id.compareTo(oId);
+ return id.compareToIgnoreCase(oId);
}
@Override
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
+import java.util.Comparator;
import java.util.List;
import be.nikiroo.fanfix.data.MetaData;
if (!sources.contains(meta.getSource()))
sources.add(meta.getSource());
}
+ sort(sources);
}
-
+
return sources;
}
}
}
+ sort(linked);
return linked;
}
if (!authors.contains(meta.getAuthor()))
authors.add(meta.getAuthor());
}
+ sort(authors);
}
-
+
return authors;
}
tags.add(tag);
}
}
+ sort(tags);
}
-
- return authors;
+
+ return tags;
}
// helper
}
// null or empty -> no check, rest = must be included
- // source: a source ending in "/" means "this or any source starting with this",
+ // source: a source ending in "/" means "this or any source starting with
+ // this",
// i;e., to enable source hierarchy
// + sorted
- public List<MetaData> filter(List<String> sources, List<String> authors, List<String> tags) {
+ public List<MetaData> filter(List<String> sources, List<String> authors,
+ List<String> tags) {
if (sources != null && sources.isEmpty())
sources = null;
if (authors != null && authors.isEmpty())
Collections.sort(result);
return result;
}
+
+ /**
+ * Sort the given {@link String} values, ignoring case.
+ *
+ * @param values
+ * the values to sort
+ */
+ private void sort(List<String> values) {
+ Collections.sort(values, new Comparator<String>() {
+ @Override
+ public int compare(String o1, String o2) {
+ return ("" + o1).compareToIgnoreCase("" + o2);
+ }
+ });
+ }
}