testskiplistpq.java
来自「一个关于java 的常用工具包」· Java 代码 · 共 70 行
JAVA
70 行
package org.jutiltest.java.collections;import org.jutil.junit.JutilTest;import org.jutil.junit.CVSRevision;import org.jutil.java.collections.SkipListPQ;import org.jutil.java.collections.ComparableComparator;/** * @path $Source: /cvsroot/org-jutil/jutil.org/src/org/jutiltest/java/collections/TestSkipListPQ.java,v $ * @version $Revision: 1.5 $ * @date $Date: 2002/07/21 18:59:18 $ * @state $State: Exp $ * @author Marko van Dooren * @release $Name: $ * */public class TestSkipListPQ extends JutilTest { public TestSkipListPQ(String name) { super(name, new CVSRevision("1.4")); } public void testAdd() { SkipListPQ pq = new SkipListPQ(new ComparableComparator()); assertTrue(pq.size() == 0); Integer five = new Integer(5); for(int i=0; i<7; i++) { pq.add(five); } assertTrue(pq.nbExplicitOccurrences(five) == 7); assertTrue(pq.size() == 7); for(int i=0; i<3932; i++) { pq.add(new Integer(i)); } // The other 5 is another object. assertTrue(pq.nbExplicitOccurrences(five) == 7); assertTrue(pq.size() == 3939); pq.clear(); assertTrue(pq.size() == 0); assertTrue(pq.isEmpty()); } public void testPop() { Integer one = new Integer(1); Integer two = new Integer(2); Integer three = new Integer(3); SkipListPQ pq = new SkipListPQ(new ComparableComparator()); pq.add(two); pq.add(one); pq.add(three); assertTrue(pq.pop() == one); assertTrue(pq.pop() == two); assertTrue(pq.pop() == three); }}/* * <copyright>Copyright (C) 1997-2001. This software is copyrighted by * the people and entities mentioned after the "@author" tags above, on * behalf of the JUTIL.ORG Project. The copyright is dated by the dates * after the "@date" tags above. All rights reserved. * This software is published under the terms of the JUTIL.ORG Software * License version 1.1 or later, a copy of which has been included with * this distribution in the LICENSE file, which can also be found at * http://org-jutil.sourceforge.net/LICENSE. This software is distributed * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the JUTIL.ORG Software License for more details. For more information, * please see http://org-jutil.sourceforge.net/</copyright> */
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?