From 19a0f088cd7d28ec7f33738bb60390aa3b415fbc Mon Sep 17 00:00:00 2001 From: SnailClimb Date: Fri, 22 Mar 2019 10:03:31 +0800 Subject: [PATCH] Update Arrays,CollectionsCommonMethods.md --- Java/Basis/Arrays,CollectionsCommonMethods.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Java/Basis/Arrays,CollectionsCommonMethods.md b/Java/Basis/Arrays,CollectionsCommonMethods.md index 140b6f05..5c7e705b 100644 --- a/Java/Basis/Arrays,CollectionsCommonMethods.md +++ b/Java/Basis/Arrays,CollectionsCommonMethods.md @@ -207,6 +207,14 @@ synchronizedSet(Set s) //返回指定 set 支持的同步(线程安全的 ``` +在做算法面试题的时候,我们还可能会经常遇到对字符串排序的情况,`Arrays.sort()` 对每个字符串的特定位置进行比较,然后按照升序排序。 + +```java +String[] strs = { "abcdehg", "abcdefg", "abcdeag" }; +Arrays.sort(strs); +System.out.println(Arrays.toString(strs));//[abcdeag, abcdefg, abcdehg] +``` + ### 查找 : `binarySearch()` ```java