代码拉取完成,页面将自动刷新
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();
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。