本文整理汇总了C#中SinglyLinkedList.RemoveFirst方法的典型用法代码示例。如果您正苦于以下问题:C# SinglyLinkedList.RemoveFirst方法的具体用法?C# SinglyLinkedList.RemoveFirst怎么用?C# SinglyLinkedList.RemoveFirst使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SinglyLinkedList
的用法示例。
在下文中一共展示了SinglyLinkedList.RemoveFirst方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RemoveFirstTest
public void RemoveFirstTest()
{
SinglyLinkedList<int> sll = new SinglyLinkedList<int>();
sll.AddFirst(40);
sll.AddFirst(30);
sll.AddFirst(20);
sll.AddFirst(10);
sll.AddLast(50);
sll.RemoveFirst();
sll.RemoveFirst();
Assert.AreEqual(30, sll.Head.Value);
Assert.AreEqual(50, sll.Tail.Value);
Assert.AreEqual(3, sll.Count);
}
示例2: TestRemoveFirst
public void TestRemoveFirst()
{
var expected = new int[2] { 0, 1 };
var list = new SinglyLinkedList<int>(expected);
list.AddFirst(-1);
Assert.AreEqual(-1, list.First.Value);
list.RemoveFirst();
Verify(expected, list);
}
示例3: RemoveFirstOneItemInListTest
public void RemoveFirstOneItemInListTest()
{
SinglyLinkedList<int> sll = new SinglyLinkedList<int> {10};
sll.RemoveFirst();
Assert.AreEqual(0, sll.Count);
Assert.IsNull(sll.Head);
Assert.IsNull(sll.Tail);
}
示例4: RemoveFirstEmptyListTest
public void RemoveFirstEmptyListTest()
{
SinglyLinkedList<int> sll = new SinglyLinkedList<int>();
Assert.IsFalse(sll.RemoveFirst());
}
示例5: Removing_Should_decrement_length
public void Removing_Should_decrement_length()
{
ISinglyLinkedList<int> list = new SinglyLinkedList<int>(new[] { 1,2,3 });
Assert.That(list.Length, Is.EqualTo(3));
list = list.RemoveFirst();
Assert.That(list.Length, Is.EqualTo(2));
list = list.RemoveAfter(list.Head);
Assert.That(list.Length, Is.EqualTo(1));
}
示例6: RemoveFirst_Should_change_tail_when_list_is_empty
public void RemoveFirst_Should_change_tail_when_list_is_empty()
{
ISinglyLinkedList<int> list = new SinglyLinkedList<int>(new[] { 1});
list = list.RemoveFirst();
Assert.That(list.Head, Is.Null);
Assert.That(list.Tail, Is.Null);
}
示例7: RemoveFirst_Should_change_head
public void RemoveFirst_Should_change_head()
{
ISinglyLinkedList<int> list = new SinglyLinkedList<int>(new[] { 1,2,3 });
list = list.RemoveFirst();
Assert.That(list.Head.Data, Is.EqualTo(2));
}