Skip to content

Commit

Permalink
[Improve] add Use isEmpty() instead of length() == 0 or `size() =…
Browse files Browse the repository at this point in the history
…= 0` rule (#293)

* [Improve] add Use `isEmpty()` instead of `length() == 0` or `size() == 0` rule

* [Improve] code style optimize
  • Loading branch information
VampireAchao authored Nov 11, 2023
1 parent 1929d85 commit 23aafe1
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
18 changes: 18 additions & 0 deletions community/submit_guide/code-style-and-quality-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,24 @@ sidebar_position: 3
public CurrentHashMap funName();
```

3. Use `isEmpty()` instead of `length() == 0` or `size() == 0`

- Negative demo:

```java
if (pathPart.length() == 0) {
return;
}
```

- Positive demo:

```java
if (pathPart.isEmpty()) {
return;
}
```

### 3.5 Concurrent Processing

1. The `thread pool` needs to be managed, using a unified entry point to obtain the `thread pool`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,24 @@ sidebar_position: 3
public CurrentHashMap funName();
```

3. 使用 `isEmpty()` 而不是 `length() == 0` 或者 `size() == 0`

- 负面示例:

```java
if (pathPart.length() == 0) {
return;
}
```

- 正面示例:

```java
if (pathPart.isEmpty()) {
return;
}
```

### 3.5 并发处理

1. 需要管理 `线程池`,使用统一的入口点获取 `线程池`。
Expand Down

0 comments on commit 23aafe1

Please sign in to comment.