📄 binarynode.java
字号:
package wlf;
/**
* 二叉节点类,元素类型未定
*/
import java.io.Serializable;
public class BinaryNode<E> implements Serializable{
/**
*
*/
private static final long serialVersionUID = 3677625897095376784L;
private E item;
private BinaryNode<E> left;
private BinaryNode<E> right;
public BinaryNode(){}
public BinaryNode(E item)
{
this.item=item;
}
public BinaryNode(E item,BinaryNode<E>left,BinaryNode<E>right)
{
this.item=item;
this.left=left;
this.right=right;
}
/**
* @return the item
*/
public E getItem() {
return item;
}
/**
* @param item the item to set
*/
public void setItem(E item) {
this.item = item;
}
/**
* @return the left
*/
public BinaryNode<E> getLeft() {
return left;
}
/**
* @param left the left to set
*/
public void setLeft(BinaryNode<E> left) {
this.left = left;
}
/**
* @return the right
*/
public BinaryNode<E> getRight() {
return right;
}
/**
* @param right the right to set
*/
public void setRight(BinaryNode<E> right) {
this.right = right;
}
/**
*
* @return 判断是否为叶节点
*/
public boolean isLeaf(){
return (left==null && right==null) ;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -