change: 精简逻辑代码.
This commit is contained in:
@@ -68,12 +68,10 @@ public class DefaultUnidirectionalStateManager<S> extends AbstractStateManager<S
|
|||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
writeLock.lock();
|
writeLock.lock();
|
||||||
// 重新检查
|
final boolean isLast;
|
||||||
if (i == currentIndex()) {
|
if (i == currentIndex() ||
|
||||||
return false;
|
(!(isLast = isLast()) && i < currentIndex()) ||
|
||||||
}
|
(isLast && i != getDefault())) {
|
||||||
if ((!isLast() && i < currentIndex()) ||
|
|
||||||
(isLast() && i != getDefault())) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
updateCurrentIndex(i);
|
updateCurrentIndex(i);
|
||||||
|
|||||||
Reference in New Issue
Block a user