原创 HashMap put

  /** * Offloaded version of put for null keys */ private V putForNullKey(V value) { for (Entry<K

原创 HashMap,基於數組來存儲數據

HashMap採用數組方式存儲key,value構成的Entry,無容量限制; HashMap基於key hash尋找entry對象存放到數組的位置,對於hash衝突採用鏈表的方式來解決; HashMap在插入元素時可能會要擴大數組的容量

原创 CountDownLatch 2

    package com.ls.java_concurrency.countdownlatch; import java.util.concurrent.BlockingQueue; import java.util.concur

原创 HashMap初始化

  public HashMap(int initialCapacity, float loadFactor) { if (initialCapacity < 0) throw new Illega

原创 Vector線程安全的ArrayList

  public class Vector<E> extends AbstractList<E> implements List<E>, RandomAccess, Cloneable, java.io.Serializa

原创 TreeSet,基於TreeMap實現

TreeSet基於TreeMap實現,支持排序; TreeSet是非線程安全的;   public class TreeSet<E> extends AbstractSet<E> implements NavigableSet<E

原创 HashMap內部Entry實現類

  static class Entry<K,V> implements Map.Entry<K,V> { final K key; V value; Entry<K,V> next;

原创 Spring類路徑掃描注入Bean

  package com.astute.sparrow.spring.ioc.method_injection; import org.springframework.beans.factory.annotation.Autowire

原创 AbstractList

/** * Returns an iterator over the elements in this list in proper sequence. * * <p>This implementation

原创 WeakHashMap相關

本文將深入地介紹關於引用對象(Reference Objects)的知識。基本上說,引用對象提供了一種對象間接引用所需內存的方式,這些引用對象保存在一個引用對象中(類ReferenceQuene),它監視這些引用對象使得其可以訪問。基於

原创 Java泛型

Java泛型(generics)是JDK 5中引入的一個新特性,允許在定義類和接口的時候使用類型參數(type parameter)。聲明的類型參數在使用時用具體的類型來替換。泛型最主要的應用是在JDK 5中的新集合類框架中。對於泛型概念

原创 AbstractList modCount

/** * The number of times this list has been <i>structurally modified</i>. * Structural modifications are tho

原创 CountDownLatch

package com.ls.java_concurrency.countdownlatch; import java.util.concurrent.CountDownLatch; /** * The first is a sta

原创 ArrayList

public class ArrayList<E> extends AbstractList<E> implements List<E>, RandomAccess, Cloneable, java.io.Serializ

原创 HashSet

Set和List最明顯的區別在於Set不允許元素重複,而List允許。 Set爲了做到不允許元素重複,採用的是基於HashMap來實現。 HashSet是非線程安全的。   public class HashSet<E> exte