1 Star 0 Fork 0

CS-IMIS-23/linan20172330newterm

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
BinarySearchTreeList.java 1.97 KB
一键复制 编辑 原始数据 按行查看 历史
package week7;
import week4.ListADT;
import week4.OrderedListADT;
import java.util.Iterator;
/**
* BinarySearchTreeList represents an ordered list implemented using a binary
* search tree.
*
* @author Lewis and Chase
* @version 4.0
*/
public class BinarySearchTreeList<T> extends LinkedBinarySearchTree<T>
implements ListADT<T>, OrderedListADT<T>, Iterable<T>
{
/**
* Creates an empty BinarySearchTreeList.
*/
public BinarySearchTreeList()
{
super();
}
/**
* Adds the given element to this list.
*
* @param element the element to be added to the list
*/
public void add(T element)
{
addElement(element);
}
/**
* Removes and returns the first element from this list.
*
* @return the first element in the list
*/
public T removeFirst()
{
return removeMin();
}
/**
* Removes and returns the last element from this list.
*
* @return the last element from the list
*/
public T removeLast()
{
return removeMax();
}
/**
* Removes and returns the specified element from this list.
*
* @param element the element being sought in the list
* @return the element from the list that matches the target
*/
public T remove(T element)
{
return removeElement(element);
}
/**
* Returns a reference to the first element on this list.
*
* @return a reference to the first element in the list
*/
public T first()
{
return findMin();
}
/**
* Returns a reference to the last element on this list.
*
* @return a reference to the last element in the list
*/
public T last()
{
return findMax();
}
/**
* Returns an iterator for the list.
*
* @return an iterator over the elements in the list
*/
@Override
public Iterator<T> iterator()
{
return iteratorInOrder();
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Java
1
https://gitee.com/CS-IMIS-23/linan20172330newterm.git
git@gitee.com:CS-IMIS-23/linan20172330newterm.git
CS-IMIS-23
linan20172330newterm
linan20172330newterm
master

搜索帮助