nonemptyballlist.java

来自「书籍"Java_面向事件编程"的附带光盘代码」· Java 代码 · 共 32 行

JAVA
32
字号
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 of a single ball and the rest of the list    public NonEmptyBallList(FilledOval anOval, BallListInterface theRest) {        oval = anOval;        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 + -
显示快捷键?