搜索Max Object Pattern实现

时间:2015-01-22 13:10:07

标签: java android guava

我最后打算写下以下课程:

 static class Max {

        private final int value;

        public Max(int value) {
            this.value = value;
        }

        public Max update(int candidate) {
            if (candidate > value)
                return new Max(candidate);

            return this;
        }

        public int getValue() {
            return value;
        }
    }

但不知怎的,我觉得我正在重新发明一些轮子,但我发现我的类路径中没有常见的实现(guava,android-api) 上面的类路径中有什么东西可以丢失,或者是一个小的lib可以做到这一点吗? 我知道Math.max - 但我想要这里的构建器模式

0 个答案:

没有答案