java语言中的PriorityQueue

import java.util.*;
public class TestPriorityQueue 
{
	public static void main(String[] args) 
	{
		Collection c =new ArrayList();
		c.add("And you're a great son!");
		PriorityQueue pq= new PriorityQueue(c);
        pq.offer("2");
		pq.offer("-4");
		
		System.out.println(pq);
		Iterator it = pq.iterator();
		while(it.hasNext()){
		   System.out.println(it.next());
		}
	}
}

你可能感兴趣的:(java)