42 lines
743 B
Java
42 lines
743 B
Java
package Uebung_Collections;
|
|
|
|
import java.util.*;
|
|
|
|
public class Uebung3_Queue implements Comparator <String>{
|
|
|
|
public static void main(String[] args) {
|
|
|
|
Queue <String> statusQueue = new PriorityQueue<String>();
|
|
|
|
statusQueue.offer("Gold");
|
|
statusQueue.offer("Bronze");
|
|
statusQueue.offer("Silber");
|
|
|
|
Queue <String> ausgabe = sortiereNachPrio(statusQueue);
|
|
|
|
for (String string : ausgabe) {
|
|
System.out.println(string);
|
|
}
|
|
}
|
|
|
|
public Queue<String> sortiereNachPrio(Queue <String> status){
|
|
|
|
Queue <String> queue = new PriorityQueue<String>(status);
|
|
|
|
|
|
Iterator <String> it = queue.iterator();
|
|
|
|
while(it.hasNext()) {
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
@Override
|
|
public int compare(String o1, String o2) {
|
|
|
|
return 0;
|
|
}
|
|
}
|