Permalink
Browse files

Simplify code

  • Loading branch information...
benfortuna committed Jun 30, 2016
1 parent 716cab4 commit 40bf2fcf2bae59b07a1619a3a5bfbe758f4bf043
@@ -35,7 +35,6 @@
import java.io.Serializable;
import java.util.HashMap;
-import java.util.Iterator;
import java.util.Map;
import java.util.ServiceLoader;
@@ -80,13 +79,10 @@ protected final void registerExtendedFactory(String key, T factory) {
*/
protected final T getFactory(String key) {
T factory = null;
- Iterator<T> it = factoryLoader.iterator();
- while (it.hasNext()) {
- factory = it.next();
- if (factorySupports(factory, key)) {
+ for (T candidate : factoryLoader) {
+ if (factorySupports(candidate, key)) {
+ factory = candidate;
break;
- } else {
- factory = null;
}
}
if (factory == null) {
@@ -99,7 +95,6 @@ protected final T getFactory(String key) {
* @return true if non-standard names are allowed, otherwise false
*/
protected boolean allowIllegalNames() {
- return CompatibilityHints
- .isHintEnabled(CompatibilityHints.KEY_RELAXED_PARSING);
+ return CompatibilityHints.isHintEnabled(CompatibilityHints.KEY_RELAXED_PARSING);
}
}
@@ -167,13 +167,7 @@ public boolean equals(Object o) {
final CalendarDateFormat that = (CalendarDateFormat) o;
- if (lenient != that.lenient) {
- return false;
- }
- if (!pattern.equals(that.pattern)) {
- return false;
- }
- return timeZone.equals(that.timeZone);
+ return lenient == that.lenient && pattern.equals(that.pattern) && timeZone.equals(that.timeZone);
}
public int hashCode() {
@@ -204,9 +204,8 @@ public boolean equals(Object o) {
TimeZone timeZone = (TimeZone) o;
- if (rawOffset != timeZone.rawOffset) return false;
-
- return !(vTimeZone != null ? !vTimeZone.equals(timeZone.vTimeZone) : timeZone.vTimeZone != null);
+ return rawOffset == timeZone.rawOffset
+ && !(vTimeZone != null ? !vTimeZone.equals(timeZone.vTimeZone) : timeZone.vTimeZone != null);
}
public int hashCode() {

0 comments on commit 40bf2fc

Please sign in to comment.