📄 fixedcomparator.java
字号:
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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -