PriorityQueue(SortedSet <? extends E > c) constructor from PriorityQueue has the following syntax.
public PriorityQueue(SortedSet <? extends E> c)
In the following code shows how to use PriorityQueue.PriorityQueue(SortedSet <? extends E > c) constructor.
import java.util.PriorityQueue; import java.util.SortedSet; import java.util.TreeSet; /*from w ww. jav a 2 s . co m*/ public class Main { public static void main(String args[]) { SortedSet<String> set = new TreeSet<String>(); PriorityQueue<String> p = new PriorityQueue<String>(set); System.out.println(p); } }
The code above generates the following result.