Example usage for java.util WeakHashMap WeakHashMap

List of usage examples for java.util WeakHashMap WeakHashMap

Introduction

In this page you can find the example usage for java.util WeakHashMap WeakHashMap.

Prototype

public WeakHashMap(int initialCapacity, float loadFactor) 

Source Link

Document

Constructs a new, empty WeakHashMap with the given initial capacity and the given load factor.

Usage

From source file:Main.java

public static void main(String[] args) {
    WeakHashMap<String, String> weakHashMap = new WeakHashMap<String, String>(100, 0.75F);

    System.out.println("Putting values into the Map");
    weakHashMap.put("1", "first");
    weakHashMap.put("2", "two");
    weakHashMap.put("3", "from java2s.com");

    // checking the size of the Map
    System.out.println("Map values: " + weakHashMap);

    Collection col = weakHashMap.values();
    System.out.println("Collection values: " + col);
}

From source file:Main.java

public static <K, V> WeakHashMap<K, V> createWeakHashMap(int initialCapacity, float loadFactor) {
    return new WeakHashMap<K, V>(initialCapacity, loadFactor);
}

From source file:Main.java

public static <K, V> WeakHashMap<K, V> newWeakHashMap(final int initialCapacity, final float loadFactor) {
    return new WeakHashMap<K, V>(initialCapacity, loadFactor);
}

From source file:WeakHashSet.java

public WeakHashSet(int initialCapacity, float loadFactor) {
    map = new WeakHashMap(initialCapacity, loadFactor);
}

From source file:com.lm.lic.manager.service.HibernateLoginService.java

/**
 *
 */
public HibernateLoginService() {
    loggedinUsers = new WeakHashMap<String, HttpSession>(15, 0.75f);
}

From source file:WeakHashSet.java

/** 
 * Constructs a new WeakHashSet with the values given passed the the backing store.
 *
 * @see java.util.WeakHashMap#WeakHashMap(int, float)
 *//* w  ww  . ja va 2 s .  c  o m*/
public WeakHashSet(final int initialCapacity, final float loadFactor) {
    backingStore = new WeakHashMap(initialCapacity, loadFactor);
}

From source file:WeakHashSet.java

/**
 * Constructs a new, empty set; the backing <tt>WeakHashMap</tt> instance has
 * the specified initial capacity and the specified load factor.
 *
 * @param      initialCapacity   the initial capacity of the hash map.
 * @param      loadFactor        the load factor of the hash map.
 * @throws     IllegalArgumentException if the initial capacity is less
 *             than zero, or if the load factor is nonpositive.
 *//*from ww  w .  j  a v  a2  s  . c  o m*/

public WeakHashSet(int initialCapacity, float loadFactor) {
    map = new WeakHashMap(initialCapacity, loadFactor);
}

From source file:org.jiemamy.utils.collection.CollectionsUtil.java

/**
 * {@link WeakHashMap}?????/*from   w w  w  .  j av a  2 s  . c o  m*/
 * 
 * @param <K> {@link WeakHashMap}??
 * @param <V> {@link WeakHashMap}??
 * @param initialCapacity ??
 * @param loadFactor ?????????
 * @return {@link WeakHashMap}???
 * @throws IllegalArgumentException  If the initial capacity is negative,
 *         or if the load factor is nonpositive.
 * @see WeakHashMap#WeakHashMap(int, float)
 */
public static <K, V> WeakHashMap<K, V> newWeakHashMap(int initialCapacity, float loadFactor) {
    return new WeakHashMap<K, V>(initialCapacity, loadFactor);
}