Skip to content

Commit 2d413e9

Browse files
committed
Refactor String API calls
1 parent b23ac6c commit 2d413e9

4 files changed

Lines changed: 4 additions & 4 deletions

File tree

commonmark-ext-gfm-tables/src/main/java/org/commonmark/ext/gfm/tables/internal/TableBlockParser.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ public static class Factory extends AbstractBlockParserFactory {
274274
@Override
275275
public BlockStart tryStart(ParserState state, MatchedBlockParser matchedBlockParser) {
276276
List<SourceLine> paragraphLines = matchedBlockParser.getParagraphLines().getLines();
277-
if (paragraphLines.size() >= 1 && Characters.find('|', paragraphLines.get(paragraphLines.size() - 1).getContent(), 0) != -1) {
277+
if (!paragraphLines.isEmpty() && Characters.find('|', paragraphLines.get(paragraphLines.size() - 1).getContent(), 0) != -1) {
278278
SourceLine line = state.getLine();
279279
SourceLine separatorLine = line.substring(state.getIndex(), line.getContent().length());
280280
List<TableCellInfo> columns = parseSeparator(separatorLine.getContent());

commonmark-ext-heading-anchor/src/main/java/org/commonmark/ext/heading/anchor/IdGenerator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public static Builder builder() {
6666
public String generateId(String text) {
6767
String normalizedIdentity = text != null ? normalizeText(text) : defaultIdentifier;
6868

69-
if (normalizedIdentity.length() == 0) {
69+
if (normalizedIdentity.isEmpty()) {
7070
normalizedIdentity = defaultIdentifier;
7171
}
7272

commonmark-ext-image-attributes/src/main/java/org/commonmark/ext/image/attributes/internal/ImageAttributesDelimiterProcessor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public int process(DelimiterRun openingRun, DelimiterRun closingRun) {
7575
node.unlink();
7676
}
7777

78-
if (attributesMap.size() > 0) {
78+
if (!attributesMap.isEmpty()) {
7979
ImageAttributes imageAttributes = new ImageAttributes(attributesMap);
8080

8181
// The new node is added as a child of the image node to which the attributes apply.

commonmark/src/main/java/org/commonmark/internal/util/Html5Entities.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ private static Map<String, String> readEntities() {
5454
try (BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(stream, charset))) {
5555
String line;
5656
while ((line = bufferedReader.readLine()) != null) {
57-
if (line.length() == 0) {
57+
if (line.isEmpty()) {
5858
continue;
5959
}
6060
int equal = line.indexOf("=");

0 commit comments

Comments
 (0)