zoukankan      html  css  js  c++  java
  • Java常用集合

    ArrayList

    实例化: ArrayList<E> list = new ArrayList<>();
    增: list.add(E e)
    删: list.remove(int index)
    差: list.contains(Object o) //若数组包含该元素,返回true
    改: set(int index, E e)
    是否为空: isEmpty()
    获取长度: size()
    

    LinkedList

    LinkedList<E> list = new LinkedList<>()
    增: add(E e)
    	addFirst()/push()链表头添加
    	addLast()/offer()链表尾添加
    删: remove() 删第一个元素
    	remove(E e) 删除置顶元素
    	pop()删除头
    	poll()查询并移除第一个元素
    查: get(int index) 按照下标获取元素
    	peek()
    长度: size()
    索引 indexOf(Object o)
    

    Set

    Set<E> set = new HashSet<>();
    add(E e)
    contains()
    equals()
    isEmpty()
    size()
    

    Map

    HashMap<K,V> map = new HashMap<>();
    put(K,V)
    containsKey(key)
    containsValue(value)
    get(key)
    isEmpty()
    remove(key)
    size()
    
  • 相关阅读:
    python 爬虫 urllib模块 url编码处理
    python 爬虫 urllib模块 目录
    python 爬虫 urllib模块介绍
    python 爬虫 目录
    爬虫 介绍
    POJ 2533
    POJ 2531
    POJ 2524
    POJ 2505
    POJ 2521
  • 原文地址:https://www.cnblogs.com/whisperbb/p/12431469.html
Copyright © 2011-2022 走看看