New Features and bugfixes.
- Fixed: AbstractCollection bulk adding methods now link to the specialized implementations. - Fixed: A bug with getElements in ArrayList. - Fixed: PriorityQueue remove/toArray function were renamed so they fit better with other interfaces. (remove => removeFirst and toArray uses a different genericType) - Added: LinkedList which is a List/PriorityDequeue/Stack which allows for more optimized use-cases and reduced boxing/unboxing. - Added: Tests for LinkedList
This commit is contained in:
@@ -66,7 +66,7 @@ public abstract class BaseIntPriorityQueueTest extends BaseIntIterableTest
|
||||
for(int i = 0;i<100;i++) {
|
||||
queue.enqueue(i);
|
||||
}
|
||||
queue.remove(40);
|
||||
queue.removeFirst(40);
|
||||
for(int i = 0;i<99;i++) {
|
||||
if(i >= 40) Assert.assertEquals(i + 1, queue.dequeue());
|
||||
else Assert.assertEquals(i, queue.dequeue());
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
package speiger.src.collections.ints.lists;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import speiger.src.collections.ints.base.BaseIntListTest;
|
||||
import speiger.src.collections.ints.base.BaseIntPriorityQueueTest;
|
||||
import speiger.src.collections.ints.base.IIntStackTests;
|
||||
import speiger.src.collections.ints.queues.IntPriorityQueue;
|
||||
|
||||
/**
|
||||
* @author Speiger
|
||||
*
|
||||
*/
|
||||
public class IntLinkedListTest extends BaseIntListTest implements IIntStackTests
|
||||
{
|
||||
@Override
|
||||
public IntLinkedList create(int[] data) {
|
||||
return new IntLinkedList(data);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Override
|
||||
public void testPush() {
|
||||
IIntStackTests.super.testPush();
|
||||
}
|
||||
|
||||
@Test
|
||||
@Override
|
||||
public void testPop() {
|
||||
IIntStackTests.super.testPop();
|
||||
}
|
||||
|
||||
/**
|
||||
* @author Speiger
|
||||
*/
|
||||
public static class IntLinkedListQueueTest extends BaseIntPriorityQueueTest {
|
||||
|
||||
@Override
|
||||
protected IntPriorityQueue create(int[] data) {
|
||||
return new IntLinkedList(data);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user