andpredicate.java

来自「BOOK:Beginning Algorithms Code Example」· Java 代码 · 共 32 行

JAVA
32
字号
package com.wrox.algorithms.iteration;/** * A {@link Predicate} that performs a boolean AND (&&) of two other predicates. * */public final class AndPredicate implements Predicate {    /** The left-hand argument. */    private final Predicate _left;    /** The right-hand argument. */    private final Predicate _right;    /**     * Constructor.     *     * @param left The left-hand argument.     * @param right The righ-hand argument.     */    public AndPredicate(Predicate left, Predicate right) {        assert left != null : "left can't be null";        assert right != null : "right can't be null";        _left = left;        _right = right;    }    public boolean evaluate(Object object) {        return _left.evaluate(object) && _right.evaluate(object);    }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?