前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >Collection和Collections

Collection和Collections

作者头像
发布2019-05-07 11:03:42
4630
发布2019-05-07 11:03:42
举报
文章被收录于专栏:WD学习记录WD学习记录

Collection接口:

int size();
boolean isEmpty();
boolean contains();
Iterator<E> iterator();
Object[] toArray();
<T> T[] toArray(T[] a);
boolean add(E e);
boolean remove(Object o);
boolean containsAll(Collection<?> c);
boolean addAll(Colletion<? extends E> c);
boolean removeAll(Collection<?> c);
boolean removeIf(Predicate<? super E> filter);
boolean retainAll(Collection<?> c);
void clear();
boolean equals(Object o);
int hashCode();
default Spliterator<E> spliterator();
default Stream<E> stream();
default Stream<E> parallelStream();

Collections

public static <T extends Comparable<? super T>> void sort(List<T> list) ;
public static <T> void sort(List<T> list, Comparator<? super T> c) ;
public static <T> int binarySearch(List<? extends Comparable<? super T>> list, T key) ;
private static <T> int indexedBinarySearch(List<? extends Comparable<? super T>> list, T key);
private static <T> int iteratorBinarySearch(List<? extends Comparable<? super T>> list, T key);
private static <T> T get(ListIterator<? extends T> i, int index);
public static <T> int binarySearch(List<? extends T> list, T key, Comparator<? super T> c);
private static <T> int indexedBinarySearch(List<? extends T> l, T key, Comparator<? super T> c);
private static <T> int iteratorBinarySearch(List<? extends T> l, T key, Comparator<? super T> c);
public static void reverse(List<?> list);
public static void shuffle(List<?> list);
public static void shuffle(List<?> list, Random rnd);
public static void swap(List<?> list, int i, int j);
private static void swap(Object[] arr, int i, int j);
public static <T> void fill(List<? super T> list, T obj);
public static <T> void copy(List<? super T> dest, List<? extends T> src);
public static <T extends Object & Comparable<? super T>> T min(Collection<? extends T> coll);
public static <T> T min(Collection<? extends T> coll, Comparator<? super T> comp);
public static <T extends Object & Comparable<? super T>> T max(Collection<? extends T> coll);
public static <T> T max(Collection<? extends T> coll, Comparator<? super T> comp);
...

Collection是集合顶级接口。提供了对集合对象的基本操作的接口方法。Collections是一个工具类,包含各种有关集合的静态多态方法,包括排序、搜索以及线程安全等各种操作,服务于Java的Collection框架。

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2019年04月22日,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档