import java.util.*;
public class PriorityCustom {
public static void main(String[] args) {
String[] words = {"apple", "crowd", "snow", "place", "snap", "zoo", "zing", "smile", "motto", "simple", "elegant","zebra"};
PriorityQueue<String> stringQueue = new PriorityQueue<String>(20,new Comparator<String>() {
String Z = "z";
String S = "s";
//@Override
public int compare(String S1,String S2) {
if (S1.startsWith(Z)) {
return +3;
}
else if (S2.startsWith(S)) {
return -1;
}
else {
return 3;
}
}
});
for (int i = 0; i < 20; i++)
PriorityQueues.add(String[] words);
while(!stringQueue.isEmpty)
System.out.println(stringQueue.remove());
}
}