guava/src/com/google/common/collect/Queues.java
public static <E extends Comparable> PriorityQueue<E> newPriorityQueue(
      Iterable<? extends E> elements) {
    if (elements instanceof Collection) {
      return new PriorityQueue<E>(Collections2.cast(elements));
    }
    PriorityQueue<E> queue = new PriorityQueue<E>();
    Iterables.addAll(queue, elements);
    return queue;
  }
public static <E extends Comparable> PriorityQueue<E> newPriorityQueue(
      Iterable<? extends E> elements) {
    if (elements instanceof Collection) {
      return new PriorityQueue<E>(Collections2.cast(elements));
    }
    PriorityQueue<E> queue = new PriorityQueue<E>();
    Iterables.addAll(queue, elements);
    return queue;
  }
public static < E extends Comparable > PriorityQueue < E > newPriorityQueue ( Iterable < ? extends E > elements ) { if ( elements instanceof Collection ) { return new PriorityQueue < E > ( Collections2 . cast ( elements ) ) ; } PriorityQueue < E > queue = new PriorityQueue < E > ( ) ; Iterables . addAll ( queue , elements ) ; return queue ; }
Creates a {@code PriorityQueue} containing the given elements.

<p><b>Note:</b> If the specified iterable is a {@code SortedSet} or a {@code PriorityQueue},
this priority queue will be ordered according to the same ordering.

@since 11.0 (requires that {@code E} be {@code Comparable} since 15.0).
Creates a { @code PriorityQueue } containing the given elements .