http://www.importnew.com/12690.html
http://www.importnew.com/12853.html
这个倒是看着不复杂

策略模式应用
Java.util.Collections#sort(List list, Comparator < ? super T > c)
java.util.Arrays#sort(T[], Comparator < ? super T > c)
HashMap中对hashcode的计算
-
class Context {
-
-
private Strategy strategy;
-
-
-
-
-
-
-
-
public Context(Strategy strategy) {
-
this.strategy = strategy;
-
}
-
-
-
-
-
public void contextInterface() {
-
-
strategy.strategyInterface();
-
}
-
-
}
-
-
interface Strategy {
-
-
-
-
public void strategyInterface();
-
}
-
-
class ConcreteStrategyA implements Strategy {
-
-
@Override
-
public void strategyInterface() {
-
-
}
-
-
}
-
-
class ConcreteStrategyB implements Strategy {
-
-
@Override
-
public void strategyInterface() {
-
-
}
-
-
}
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/29254281/viewspace-2135735/
,如需转载,请注明出处,否则将追究法律责任。