public class PageSorter extends Object implements Comparator<String>
Note - this class is deliberately not null safe. Never call any of the methods with a null argument!
Modifier and Type | Field and Description |
---|---|
protected static String |
PROP_PAGE_NAME_COMPARATOR |
Constructor and Description |
---|
PageSorter()
Default constructor uses Java "natural" ordering.
|
PageSorter(Comparator<String> comparator)
Construct with a particular comparator.
|
Modifier and Type | Method and Description |
---|---|
int |
compare(String pageName1,
String pageName2)
Compare two page names (String version).
|
boolean |
equals(Object o) |
void |
initialize(Properties props)
Called by WikiEngine to initialise this instance.
|
void |
sort(List<String> nameList)
Sorts the specified list into ascending order based on the
PageNameComparator.
|
void |
sort(String[] nameArray)
Sorts the specified array into ascending order based on the
PageNameComparator.
|
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
comparing, comparing, comparingDouble, comparingInt, comparingLong, naturalOrder, nullsFirst, nullsLast, reversed, reverseOrder, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
protected static final String PROP_PAGE_NAME_COMPARATOR
public PageSorter()
public PageSorter(Comparator<String> comparator)
comparator
- the Comparator to usepublic int compare(String pageName1, String pageName2)
compare
in interface Comparator<String>
pageName1
- the first page namepageName2
- the second page nameComparator.compare(java.lang.Object, java.lang.Object)
public boolean equals(Object o)
equals
in interface Comparator<String>
equals
in class Object
public void initialize(Properties props)
props
- this WikiEngine's properties.public void sort(List<String> nameList)
Collections.sort()
.nameList
- the page names to be sortedCopyright © 2001-2019 The Apache Software Foundation. All rights reserved.