集合知识点总结

Arrays工具类

  • .binarySearch()
  • .sort()
  • .fill() //填充
    int[] array = new int[10];
Arrays.fill(array,1,3,2); // 结果为[0,2,2,0,0,0,0,0,0,]
Arrays.fill(array,1);// 结果全都为1
  • .toString() // 将集合作为字符输出

Collections工具类

  • Collections.max()
  • .reverse() // 翻转
  • .sort() // 排序,list可以使用sort,set不能排序
  • .binarySearch() //二分查找,只能对有序集合使用
  • .max()
  • .min()
  • .addAll(Collection<? super T> c, T... elements)// 把所有elements添加到集合
  • .replaceAll(List list, T oldVal, T newVal) // 替换list所有目标元素
  • .swap(List<?> list, int i, int j) // 交换
  • .binarySearch(List<? extends Comparable<? super T>> list, T key)

Arrays工具类和Collections工具类的更多相关文章

  1. LinkedHashSet、Map、Map接口HashMap、Hashtable,TreeSet、TreeMap、如何选择使用集合实现类,Collections工具类

    一.Set接口实现类LinkedHashSet 实现继承图: 1.LinkedHashSet的全面说明 1) LinkedHashSet是 HashSet的子类 2) LinkedHashSet底层是 ...

  2. Arrays工具类与Collections工具类

    Arrays工具类 : Arrays.sort():对指定数组进行排序,从小到大 Arrays.toString():返回数组的内容的字符串表示形式 Arrays.asList():数组转List,但 ...

  3. Java基础---泛型、集合框架工具类:collections和Arrays

    第一讲     泛型(Generic) 一.概述 1.JDK1.5版本以后出现的新特性.用于解决安全问题,是一个类型安全机制. 2.JDK1.5的集合类希望在定义集合时,明确表明你要向集合中装入那种类 ...

  4. Java精选笔记_集合概述(Collection接口、Collections工具类、Arrays工具类)

    集合概述 集合有时又称为容器,简单地说,它是一个对象,能将具有相同性质的多个元素汇聚成一个整体.集合被用于存储.获取.操纵和传输聚合的数据. 使用集合的技巧 看到Array就是数组结构,有角标,查询速 ...

  5. Java容器---Arrays & Collections工具类

    1.Array & Arrays 与Collection & Collections区别 (1)Collection": 是一个接口,与其子类共同组成一个Collection ...

  6. Collections 工具类和 Arrays 工具类常见方法

    Collections Collections 工具类常用方法: 排序 查找,替换操作 同步控制(不推荐,需要线程安全的集合类型时请考虑使用 JUC 包下的并发集合) 排序操作 void revers ...

  7. Java容器类Collection,List,Set,Map.,Iterator,Collections工具类,Arrays工具类,Comparable

    Java容器类Collection,List,Set,Map.,Iterator,Collections工具类,Arrays工具类,Comparable接口,泛型 Collection,List,Se ...

  8. 34、Collections工具类简介

    Collections工具类简介 就像数组中的Arrays工具类一样,在集合里面也有跟Arrays类似的工具类Collections package com.sutaoyu.Collections; ...

  9. Java 之 Collections 工具类

    一.Collections 概述 java.utils.Collections 是集合工具类,用来对集合进行操作. 二.常用方法 public static <T> boolean add ...

随机推荐

  1. 记录一下我在lubuntu里面用到的工具

    文本编辑:Atom 文本对比:Beyond Compare 数据库工具:dbeaver Git工具:GitKraKen SVN工具:RapidSVN 网页编程工具:WebStorm 另外,14.04版 ...

  2. CSS之padding&margin

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  3. enctype=“multipart/form-data”详解

    enctype这个属性管理的是表单的MIME(Multipurpose Internet Mail Extensions)编码,共有三个值可选: 1.application/x-www-form-ur ...

  4. Vue中table合并单元格用法

    <table> <tr> <th>地名</th> <th>结果</th> <th>人名</th> < ...

  5. 使用IntelliJ IDEA创建简单的Dubbo实例

    这个博客是在https://blog.csdn.net/Crazer_cy/article/details/80397649篇文章上的基础上,自己学习用的. Zookeeper为dubbo的注册中心, ...

  6. centos svn强制要求提交代码时写注释

    1. 重命名svn主目录中hooks的pre-commit.tmpl文件为pre-commit,并添加可执行权限 mv pre-commit.tmpl pre-commit chmod u+x pre ...

  7. mybatis拦截器获取sql

    mybatis获取sql代码 package com.icourt.alpha.log.interceptor; import org.apache.ibatis.executor.Executor; ...

  8. Linux输入子系统详解

    input输入子系统框架  linux输入子系统(linux input subsystem)从上到下由三层实现,分别为:输入子系统事件处理层(EventHandler).输入子系统核心层(Input ...

  9. C#、Unity 数据类型的默认值

    using System.Collections; using System.Collections.Generic; using UnityEngine; public class Main : M ...

  10. 关于ie6块元素行内元素转换

    1.inline元素的display属性设置为inline-block时,所有的浏览器都支持: 2.block元素的display属性设置为inline-block时,IE6/IE7浏览器是不支持的: ...