Example #1
0
  @Test
  public void shouldMergeTwoPriorityQueues() {
    final PriorityQueue<Integer> source = of(3, 1, 4, 1, 5);
    final PriorityQueue<Integer> target = of(9, 2, 6, 5, 3);
    assertThat(source.merge(target)).isEqualTo(of(3, 1, 4, 1, 5, 9, 2, 6, 5, 3));

    assertThat(PriorityQueue.of(3).merge(PriorityQueue.of(toStringComparator(), 1)))
        .isEqualTo(of(3, 1));
  }