📄 linkedlist1demo.java
字号:
public class LinkedList1Demo
{
public static void main(String[] args)
{
LinkedList1 list = new LinkedList1( );
list.addToStart("Apples", 1);
list.addToStart("Bananas", 2);
list.addToStart("Cantaloupe", 3);
System.out.println("List has " + list.size( )
+ " nodes.");
list.outputList( );
if (list.contains("Cantaloupe"))
System.out.println("Cantaloupe is on list.");
else
System.out.println("Cantaloupe is NOT on list.");
list.deleteHeadNode( );
if (list.contains("Cantaloupe"))
System.out.println("Cantaloupe is on list.");
else
System.out.println("Cantaloupe is NOT on list.");
while (list.deleteHeadNode( ))
; //Empty loop body
System.out.println("Start of list:");
list.outputList( );
System.out.println("End of list.");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -