Replaced ternary operators

This commit is contained in:
Patrick Gotthard 2013-10-07 18:33:00 +02:00
parent 8186194722
commit d5fe56101f
2 changed files with 32 additions and 7 deletions

View file

@ -156,7 +156,10 @@ public class Feed extends WireFeed {
* list if none. * list if none.
*/ */
public List<Link> getAlternateLinks() { public List<Link> getAlternateLinks() {
return alternateLinks == null ? (alternateLinks = new ArrayList<Link>()) : alternateLinks; if (alternateLinks == null) {
alternateLinks = new ArrayList<Link>();
}
return alternateLinks;
} }
/** /**
@ -178,7 +181,10 @@ public class Feed extends WireFeed {
* ones), an empty list if none. * ones), an empty list if none.
*/ */
public List<Link> getOtherLinks() { public List<Link> getOtherLinks() {
return otherLinks == null ? (otherLinks = new ArrayList<Link>()) : otherLinks; if (otherLinks == null) {
otherLinks = new ArrayList<Link>();
}
return otherLinks;
} }
/** /**
@ -381,7 +387,10 @@ public class Feed extends WireFeed {
* *
*/ */
public List<Entry> getEntries() { public List<Entry> getEntries() {
return entries == null ? (entries = new ArrayList<Entry>()) : entries; if (entries == null) {
entries = new ArrayList<Entry>();
}
return entries;
} }
/** /**
@ -406,7 +415,10 @@ public class Feed extends WireFeed {
*/ */
@Override @Override
public List<Module> getModules() { public List<Module> getModules() {
return modules == null ? (modules = new ArrayList<Module>()) : modules; if (modules == null) {
modules = new ArrayList<Module>();
}
return modules;
} }
/** /**
@ -442,7 +454,10 @@ public class Feed extends WireFeed {
* @since Atom 1.0 * @since Atom 1.0
*/ */
public List<Category> getCategories() { public List<Category> getCategories() {
return categories == null ? (categories = new ArrayList<Category>()) : categories; if (categories == null) {
categories = new ArrayList<Category>();
}
return categories;
} }
/** /**

View file

@ -190,7 +190,12 @@ public class ToStringBean implements Serializable {
tsInfo[0] = ePrefix; tsInfo[0] = ePrefix;
final Stack<String[]> stack = PREFIX_TL.get(); final Stack<String[]> stack = PREFIX_TL.get();
stack.push(tsInfo); stack.push(tsInfo);
final String s = eValue != null ? eValue.toString() : "null"; final String s;
if (eValue == null) {
s = "null";
} else {
s = eValue.toString();
}
stack.pop(); stack.pop();
if (tsInfo[1] == null) { if (tsInfo[1] == null) {
sb.append(ePrefix).append("=").append(s).append("\n"); sb.append(ePrefix).append("=").append(s).append("\n");
@ -216,7 +221,12 @@ public class ToStringBean implements Serializable {
tsInfo[0] = cPrefix; tsInfo[0] = cPrefix;
final Stack<String[]> stack = PREFIX_TL.get(); final Stack<String[]> stack = PREFIX_TL.get();
stack.push(tsInfo); stack.push(tsInfo);
final String s = cValue != null ? cValue.toString() : "null"; final String s;
if (cValue == null) {
s = "null";
} else {
s = cValue.toString();
}
stack.pop(); stack.pop();
if (tsInfo[1] == null) { if (tsInfo[1] == null) {
sb.append(cPrefix).append("=").append(s).append("\n"); sb.append(cPrefix).append("=").append(s).append("\n");