Skip to content
Permalink
Browse files
No need to nest in else.
  • Loading branch information
garydgregory committed Mar 5, 2021
1 parent b0839bd commit 5151c6a6df48e86151ddffd3638eed45a4cedd65
Show file tree
Hide file tree
Showing 13 changed files with 177 additions and 265 deletions.
@@ -147,15 +147,12 @@ private static List<ImmutableNode> constructHierarchy(final String key,
{
return parseMap((Map<String, Object>) elem, key);
}
else if (elem instanceof Collection)
if (elem instanceof Collection)
{
return parseCollection((Collection<Object>) elem, key);
}
else
{
return Collections.singletonList(
new ImmutableNode.Builder().name(key).value(elem).create());
}
return Collections.singletonList(
new ImmutableNode.Builder().name(key).value(elem).create());
}

/**
@@ -817,14 +817,10 @@ private void insertNewChildNodes(final ImmutableNode node,
while (children.hasNext())
{
nd = children.next();
if (refHandler.getReference(nd) == null)
{
newNodes.add(nd);
}
else
{
if (refHandler.getReference(nd) != null) {
break;
}
newNodes.add(nd);
}

// Insert all new nodes
@@ -1036,14 +1036,11 @@ public Date getDate(final String key, final String format)
{
return value;
}
else if (isThrowExceptionOnMissing())
if (isThrowExceptionOnMissing())
{
throw new NoSuchElementException('\'' + key + "' doesn't map to an existing object");
}
else
{
return null;
}
return null;
}

/**
@@ -1280,14 +1277,11 @@ public Calendar getCalendar(final String key, final String format)
{
return value;
}
else if (isThrowExceptionOnMissing())
if (isThrowExceptionOnMissing())
{
throw new NoSuchElementException('\'' + key + "' doesn't map to an existing object");
}
else
{
return null;
}
return null;
}

/**
@@ -434,16 +434,12 @@ public String readProperty() throws IOException
line = line.substring(i);
}

if (checkCombineLines(line))
{
line = line.substring(0, line.length() - 1);
buffer.append(line);
}
else
{
if (!checkCombineLines(line)) {
buffer.append(line);
break;
}
line = line.substring(0, line.length() - 1);
buffer.append(line);
}
return buffer.toString();
}
@@ -793,16 +789,12 @@ public String readProperty() throws IOException

line = line.trim();

if (checkCombineLines(line))
{
line = line.substring(0, line.length() - 1);
buffer.append(line);
}
else
{
if (!checkCombineLines(line)) {
buffer.append(line);
break;
}
line = line.substring(0, line.length() - 1);
buffer.append(line);
}
return buffer.toString();
}
@@ -1443,7 +1435,7 @@ else if (needsUnescape(ch))

continue;
}
else if (ch == '\\')
if (ch == '\\')
{
hadSlash = true;
continue;
@@ -50,7 +50,7 @@ public boolean compare(final Configuration a, final Configuration b)
{
return true;
}
else if (a == null || b == null)
if (a == null || b == null)
{
return false;
}

0 comments on commit 5151c6a

Please sign in to comment.