PriorityBlockingQueueTest.java 文件源码

java
阅读 39 收藏 0 点赞 0 评论 0

项目:openjdk-jdk10 作者:
/**
 * retainAll(c) retains only those elements of c and reports true if changed
 */
public void testRetainAll() {
    PriorityBlockingQueue q = populatedQueue(SIZE);
    PriorityBlockingQueue p = populatedQueue(SIZE);
    for (int i = 0; i < SIZE; ++i) {
        boolean changed = q.retainAll(p);
        if (i == 0)
            assertFalse(changed);
        else
            assertTrue(changed);

        assertTrue(q.containsAll(p));
        assertEquals(SIZE - i, q.size());
        p.remove();
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号