📄 list.java
字号:
//List.java//Linked list class, holds URL informationpublic abstract class List { protected WebNode head; protected int size = 0; public List() { head = null; } public void remove(String s) throws Exception {//Remove URL } public void add(String url) {//AddURL WebNode placeHolder = new WebNode(); placeHolder.setURL(url); placeHolder.setNext(head); head=placeHolder; size++; } public String getName(int i) throws Exception{//Returns the name of a URL WebNode wn = head; if (isEmpty()) throw new Exception("记录为空"); for (int x = 0; x < i; x++) {//查找下一个URL,并且返回其值 wn = wn.getNext(); } return wn.getURL(); } public int getSize() {return size;}//ListSize public boolean isEmpty() { return (head == null); }//the list is empty or not}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -