fixedcomparator.java
来自「BOOK:Beginning Algorithms Code Example」· Java 代码 · 共 22 行
JAVA
22 行
package com.wrox.algorithms.sorting;/** * A {@link Comparator} that always returns the same result irrespective of the arguments. * */public class FixedComparator implements Comparator { private final int _result; /** * Constructor. * @param result The result ro return from {@link #compare(Object, Object)}. */ public FixedComparator(int result) { _result = result; } public int compare(Object left, Object right) throws ClassCastException { return _result; }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?