8000 Update Arrays,CollectionsCommonMethods.md · kevinsan/JavaGuide@19a0f08 · GitHub
[go: up one dir, main page]

Skip to content

Commit 19a0f08

Browse files
authored
Update Arrays,CollectionsCommonMethods.md
1 parent f748cfd commit 19a0f08

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

Java/Basis/Arrays,CollectionsCommonMethods.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,14 @@ synchronizedSet(Set<T> s) //返回指定 set 支持的同步(线程安全的
207207

208208
```
209209

210+
在做算法面试题的时候,我们还可能会经常遇到对字符串排序的情况,`Arrays.sort()` 对每个字符串的特定位置进行比较,然后按照升序排序。
211+
212+
```java
213+
String[] strs = { "abcdehg", "abcdefg", "abcdeag" };
214+
Arrays.sort(strs);
215+
System.out.println(Arrays.toString(strs));//[abcdeag, abcdefg, abcdehg]
216+
```
217+
210218
### 查找 : `binarySearch()`
211219

212220
```java

0 commit comments

Comments
 (0)
0