Java基礎筆記——集合工具類

來源:互聯網
上載者:User

標籤:java基礎   ever   eve   實現   nbsp   collect   max   set   對象   

 1 package collections_show; 2 /* 3  * 操作集合Collection的工具類Collections 4  * 說明: 5     Collections 是一個操作 Set、List 和 Map 等集合的工具類 6     Collections 中提供了一系列靜態方法對集合元素進行排序、查詢和修改等操作,還提供了對集合對象設定不可變、對集合對象實現同步控制等方法 7      8     排序操作:(均為static方法)  都是List 9 --->    reverse(List):反轉 List 中元素的順序10 --->    shuffle(List):對 List 集合元素進行隨機排序11 --->    sort(List):根據元素的自然順序對指定 List 集合元素按升序排序12 ?        sort(List,Comparator):根據指定的 Comparator 產生的順序對 List 集合元素進行排序13 ?        swap(List,int, int):將指定 list 集合中的 i 處元素和 j 處元素進行交換14 ?        void copy(List dest,List src):將src中的內容複寫到dest中15     尋找替換16 ?        Object max(Collection):根據元素的自然順序,返回給定集合中的最大元素17 ?        Object max(Collection,Comparator):根據 Comparator 指定的順序,返回給定集合中的最大元素18 ?        Object min(Collection)19 ?        Object min(Collection,Comparator)20 --->    int frequency(Collection,Object):返回指定集合中指定元素的出現次數21 ?        boolean replaceAll(List list,Object oldVal,Object newVal):使用新值替換 List 對象的所有舊值22 23  */24 public class Collections_Method {25 26 }

 

Java基礎筆記——集合工具類

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.