zoukankan      html  css  js  c++  java
  • Collection接口源码解读

    Collection<E> extends Iterable<E> 是为了让集合里的元素能够使用forEach 循环语句

    方法:
    int size():返回此集合中的元素数量
    boolean isEmpty():判断集合元素是否为空
    boolean contains(Object o):判断此集合是否包含指定的元素,包含则返回true,反之
    Iterator<E> iterator():返回此集合中元素的迭代器,不保证元素返回的顺序(除非此集合是提供保证的某个类的实例)。
    Object[] toArray():将此集合中的元素转换成数组并返回该数组,该方法作为基于数组和集合之间的桥梁的api
    <T> T[] toArray(T[] a):返回指定类型数组
    boolean add(E e):此集合添加指定元素
    boolean remove(Object o):删除指定元素
    boolean containsAll(Collection<?> c):判断是否包含特定集合,如果存在则返回true 反之
    boolean addAll(Collection<? extends E> c):添加指定集合
    boolean removeAll(Collection<?> c):删除指定集合
    default boolean removeIf(Predicate<? super E> filter):移除此集合中满足给定条件的所有元素
    boolean retainAll(Collection<?> c):仅保留指定类型的集合
    void clear():清空集合元素
    boolean equals(Object o):将指定的对象与此集合进行相等性较
    int hashCode():返回集合的哈希值,用于比较相等与否
    default Spliterator<E> spliterator():


    What do you want to be?
  • 相关阅读:
    html5语法
    Addthis使用
    css font-weight原理
    css3 background
    jquery对标签属性操作
    给textarea添加背景图
    label的for属性
    css3 text-shadow
    z-index堆叠规则
    css3 @font-face
  • 原文地址:https://www.cnblogs.com/CatsBlog/p/10584868.html
Copyright © 2011-2022 走看看