mirror of
https://github.com/Snailclimb/JavaGuide
synced 2025-06-16 18:10:13 +08:00
Update Arrays,CollectionsCommonMethods.md
This commit is contained in:
parent
f748cfd355
commit
19a0f088cd
@ -207,6 +207,14 @@ synchronizedSet(Set<T> s) //返回指定 set 支持的同步(线程安全的
|
|||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
在做算法面试题的时候,我们还可能会经常遇到对字符串排序的情况,`Arrays.sort()` 对每个字符串的特定位置进行比较,然后按照升序排序。
|
||||||
|
|
||||||
|
```java
|
||||||
|
String[] strs = { "abcdehg", "abcdefg", "abcdeag" };
|
||||||
|
Arrays.sort(strs);
|
||||||
|
System.out.println(Arrays.toString(strs));//[abcdeag, abcdefg, abcdehg]
|
||||||
|
```
|
||||||
|
|
||||||
### 查找 : `binarySearch()`
|
### 查找 : `binarySearch()`
|
||||||
|
|
||||||
```java
|
```java
|
||||||
|
Loading…
x
Reference in New Issue
Block a user