nonemptyballlist.java~
来自「书籍"Java_面向事件编程"的附带光盘代码」· JAVA~ 代码 · 共 34 行
JAVA~
34 行
import objectdraw.*;/* * A non-empty ball list. This list contains a single ball, * and the rest of the list after the first ball. */public class NonEmptyBallList implements BallListInterface { private FilledOval oval; private BallListInterface rest; // Create a list out a single ball and the rest of the list public NonEmptyBallList(FilledOval theOval, BallListInterface theRest) { oval = theOval; rest = theRest; } public boolean isEmpty() { return false; } // Return the first element. public FilledOval getFirst() { return oval; } // Return the ListInterface object that represents the rest // of the list. public BallListInterface getRest() { return rest; } }
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?