Skip to content

Commit e20023d

Browse files
committed
Use isEmpty().
1 parent 353771a commit e20023d

3 files changed

Lines changed: 4 additions & 4 deletions

File tree

src/main/java/org/apache/commons/cli/DefaultParser.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ private boolean isShortOption(final String token)
360360
return true;
361361
}
362362
// check for several concatenated short options
363-
return optName.length() > 0 && options.hasShortOption(String.valueOf(optName.charAt(0)));
363+
return !optName.isEmpty() && options.hasShortOption(String.valueOf(optName.charAt(0)));
364364
}
365365

366366
/**

src/main/java/org/apache/commons/cli/HelpFormatter.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -553,14 +553,14 @@ public void printHelp(final PrintWriter pw, final int width, final String cmdLin
553553
printUsage(pw, width, cmdLineSyntax);
554554
}
555555

556-
if (header != null && header.trim().length() > 0)
556+
if (header != null && !header.trim().isEmpty())
557557
{
558558
printWrapped(pw, width, header);
559559
}
560560

561561
printOptions(pw, width, options, leftPad, descPad);
562562

563-
if (footer != null && footer.trim().length() > 0)
563+
if (footer != null && !footer.trim().isEmpty())
564564
{
565565
printWrapped(pw, width, footer);
566566
}

src/main/java/org/apache/commons/cli/Option.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ public String getArgName()
356356
*/
357357
public boolean hasArgName()
358358
{
359-
return argName != null && argName.length() > 0;
359+
return argName != null && !argName.isEmpty();
360360
}
361361

362362
/**

0 commit comments

Comments
 (0)