亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? weakfasthashmap.java

?? 這是一個有關common beanutils 的源碼
?? JAVA
?? 第 1 頁 / 共 2 頁
字號:
/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.apache.commons.beanutils;

import java.util.Collection;
import java.util.ConcurrentModificationException;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import java.util.WeakHashMap;

/**
 * <p>A customized implementation of <code>java.util.HashMap</code> designed
 * to operate in a multithreaded environment where the large majority of
 * method calls are read-only, instead of structural changes.  When operating
 * in "fast" mode, read calls are non-synchronized and write calls perform the
 * following steps:</p>
 * <ul>
 * <li>Clone the existing collection
 * <li>Perform the modification on the clone
 * <li>Replace the existing collection with the (modified) clone
 * </ul>
 * <p>When first created, objects of this class default to "slow" mode, where
 * all accesses of any type are synchronized but no cloning takes place.  This
 * is appropriate for initially populating the collection, followed by a switch
 * to "fast" mode (by calling <code>setFast(true)</code>) after initialization
 * is complete.</p>
 *
 * <p><strong>NOTE</strong>: If you are creating and accessing a
 * <code>HashMap</code> only within a single thread, you should use
 * <code>java.util.HashMap</code> directly (with no synchronization), for
 * maximum performance.</p>
 *
 * <p><strong>NOTE</strong>: <i>This class is not cross-platform.  
 * Using it may cause unexpected failures on some architectures.</i>
 * It suffers from the same problems as the double-checked locking idiom.  
 * In particular, the instruction that clones the internal collection and the 
 * instruction that sets the internal reference to the clone can be executed 
 * or perceived out-of-order.  This means that any read operation might fail 
 * unexpectedly, as it may be reading the state of the internal collection
 * before the internal collection is fully formed.
 * For more information on the double-checked locking idiom, see the
 * <a href="http://www.cs.umd.edu/~pugh/java/memoryModel/DoubleCheckedLocking.html">
 * Double-Checked Locking Idiom Is Broken Declaration</a>.</p>
 *
 * @since Commons Collections 1.0
 * @version $Revision: 687089 $ $Date: 2008-08-19 17:33:30 +0100 (Tue, 19 Aug 2008) $
 * 
 * @author Craig R. McClanahan
 * @author Stephen Colebourne
 */
class WeakFastHashMap extends HashMap {

    /**
     * The underlying map we are managing.
     */
    private Map map = null;

    /**
     * Are we currently operating in "fast" mode?
     */
    private boolean fast = false;

    // Constructors
    // ----------------------------------------------------------------------

    /**
     * Construct an empty map.
     */
    public WeakFastHashMap() {
        super();
        this.map = createMap();
    }

    /**
     * Construct an empty map with the specified capacity.
     *
     * @param capacity  the initial capacity of the empty map
     */
    public WeakFastHashMap(int capacity) {
        super();
        this.map = createMap(capacity);
    }

    /**
     * Construct an empty map with the specified capacity and load factor.
     *
     * @param capacity  the initial capacity of the empty map
     * @param factor  the load factor of the new map
     */
    public WeakFastHashMap(int capacity, float factor) {
        super();
        this.map = createMap(capacity, factor);
    }

    /**
     * Construct a new map with the same mappings as the specified map.
     *
     * @param map  the map whose mappings are to be copied
     */
    public WeakFastHashMap(Map map) {
        super();
        this.map = createMap(map);
    }


    // Property access
    // ----------------------------------------------------------------------

    /**
     *  Returns true if this map is operating in fast mode.
     *
     *  @return true if this map is operating in fast mode
     */
    public boolean getFast() {
        return (this.fast);
    }

    /**
     *  Sets whether this map is operating in fast mode.
     *
     *  @param fast true if this map should operate in fast mode
     */
    public void setFast(boolean fast) {
        this.fast = fast;
    }


    // Map access
    // ----------------------------------------------------------------------
    // These methods can forward straight to the wrapped Map in 'fast' mode.
    // (because they are query methods)

    /**
     * Return the value to which this map maps the specified key.  Returns
     * <code>null</code> if the map contains no mapping for this key, or if
     * there is a mapping with a value of <code>null</code>.  Use the
     * <code>containsKey()</code> method to disambiguate these cases.
     *
     * @param key  the key whose value is to be returned
     * @return the value mapped to that key, or null
     */
    public Object get(Object key) {
        if (fast) {
            return (map.get(key));
        } else {
            synchronized (map) {
                return (map.get(key));
            }
        }
    }

    /**
     * Return the number of key-value mappings in this map.
     * 
     * @return the current size of the map
     */
    public int size() {
        if (fast) {
            return (map.size());
        } else {
            synchronized (map) {
                return (map.size());
            }
        }
    }

    /**
     * Return <code>true</code> if this map contains no mappings.
     * 
     * @return is the map currently empty
     */
    public boolean isEmpty() {
        if (fast) {
            return (map.isEmpty());
        } else {
            synchronized (map) {
                return (map.isEmpty());
            }
        }
    }

    /**
     * Return <code>true</code> if this map contains a mapping for the
     * specified key.
     *
     * @param key  the key to be searched for
     * @return true if the map contains the key
     */
    public boolean containsKey(Object key) {
        if (fast) {
            return (map.containsKey(key));
        } else {
            synchronized (map) {
                return (map.containsKey(key));
            }
        }
    }

    /**
     * Return <code>true</code> if this map contains one or more keys mapping
     * to the specified value.
     *
     * @param value  the value to be searched for
     * @return true if the map contains the value
     */
    public boolean containsValue(Object value) {
        if (fast) {
            return (map.containsValue(value));
        } else {
            synchronized (map) {
                return (map.containsValue(value));
            }
        }
    }

    // Map modification
    // ----------------------------------------------------------------------
    // These methods perform special behaviour in 'fast' mode.
    // The map is cloned, updated and then assigned back.
    // See the comments at the top as to why this won't always work.

    /**
     * Associate the specified value with the specified key in this map.
     * If the map previously contained a mapping for this key, the old
     * value is replaced and returned.
     *
     * @param key  the key with which the value is to be associated
     * @param value  the value to be associated with this key
     * @return the value previously mapped to the key, or null
     */
    public Object put(Object key, Object value) {
        if (fast) {
            synchronized (this) {
                Map temp = cloneMap(map);
                Object result = temp.put(key, value);
                map = temp;
                return (result);
            }
        } else {
            synchronized (map) {
                return (map.put(key, value));
            }
        }
    }

    /**
     * Copy all of the mappings from the specified map to this one, replacing
     * any mappings with the same keys.
     *
     * @param in  the map whose mappings are to be copied
     */
    public void putAll(Map in) {
        if (fast) {
            synchronized (this) {
                Map temp =  cloneMap(map);
                temp.putAll(in);
                map = temp;
            }
        } else {
            synchronized (map) {
                map.putAll(in);
            }
        }
    }

    /**
     * Remove any mapping for this key, and return any previously
     * mapped value.
     *
     * @param key  the key whose mapping is to be removed
     * @return the value removed, or null
     */
    public Object remove(Object key) {
        if (fast) {
            synchronized (this) {
                Map temp = cloneMap(map);
                Object result = temp.remove(key);
                map = temp;
                return (result);
            }
        } else {
            synchronized (map) {
                return (map.remove(key));
            }
        }
    }

    /**
     * Remove all mappings from this map.
     */
    public void clear() {
        if (fast) {
            synchronized (this) {
                map = createMap();
            }
        } else {
            synchronized (map) {
                map.clear();
            }
        }
    }

    // Basic object methods
    // ----------------------------------------------------------------------
    
    /**
     * Compare the specified object with this list for equality.  This
     * implementation uses exactly the code that is used to define the
     * list equals function in the documentation for the
     * <code>Map.equals</code> method.
     *
     * @param o  the object to be compared to this list
     * @return true if the two maps are equal
     */
    public boolean equals(Object o) {
        // Simple tests that require no synchronization
        if (o == this) {
            return (true);
        } else if (!(o instanceof Map)) {
            return (false);
        }
        Map mo = (Map) o;

        // Compare the two maps for equality
        if (fast) {
            if (mo.size() != map.size()) {
                return (false);
            }
            Iterator i = map.entrySet().iterator();
            while (i.hasNext()) {
                Map.Entry e = (Map.Entry) i.next();
                Object key = e.getKey();
                Object value = e.getValue();
                if (value == null) {
                    if (!(mo.get(key) == null && mo.containsKey(key))) {
                        return (false);
                    }
                } else {
                    if (!value.equals(mo.get(key))) {
                        return (false);
                    }
                }
            }
            return (true);
            
        } else {
            synchronized (map) {
                if (mo.size() != map.size()) {
                    return (false);
                }
                Iterator i = map.entrySet().iterator();
                while (i.hasNext()) {
                    Map.Entry e = (Map.Entry) i.next();
                    Object key = e.getKey();
                    Object value = e.getValue();
                    if (value == null) {
                        if (!(mo.get(key) == null && mo.containsKey(key))) {

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩欧美成人激情| 99久久国产免费看| 国产91精品入口| 色屁屁一区二区| 欧美电影在线免费观看| 欧美精品一区二区三区一线天视频 | 一本久道久久综合中文字幕| 欧美精品亚洲二区| 国产情人综合久久777777| 国产精品家庭影院| 日本不卡视频一二三区| 粉嫩绯色av一区二区在线观看 | 一二三四社区欧美黄| 亚洲国产精品久久久久婷婷884 | 精品国产乱码久久久久久免费 | 成人ar影院免费观看视频| 欧美婷婷六月丁香综合色| 亚洲视频免费看| 亚洲一区二区3| 欧美日韩国产影片| 色婷婷综合久久| 欧美电影免费观看高清完整版在线 | 国产亚洲自拍一区| 亚洲自拍偷拍麻豆| 久久成人免费网站| 欧美亚洲动漫精品| 久久亚洲免费视频| 亚洲电影一级黄| 成人妖精视频yjsp地址| 欧美一区二区精品| 亚洲欧美国产高清| 国产精品996| 欧美一级视频精品观看| 亚洲视频在线观看一区| 国精产品一区一区三区mba视频 | 亚洲成人激情综合网| 国产福利不卡视频| 日韩一区二区三| 激情综合亚洲精品| 欧美日韩一区二区三区视频| 国产精品污网站| 紧缚奴在线一区二区三区| 欧美性受xxxx| 国产精品理论片在线观看| 激情综合五月天| 欧美一区二区三区四区视频| 亚洲精选视频在线| 成人avav在线| 国产欧美精品一区aⅴ影院| 青青草成人在线观看| 色菇凉天天综合网| 亚洲欧美日韩国产中文在线| 成人午夜视频在线观看| 精品日韩av一区二区| 日韩制服丝袜av| 91九色最新地址| 亚洲精品免费在线| 91网站最新地址| 中文字幕国产一区| 成人在线视频首页| 国产亚洲欧洲997久久综合| 另类成人小视频在线| 777亚洲妇女| 日韩中文字幕av电影| 欧美精品一级二级三级| 亚洲观看高清完整版在线观看| 91亚洲精品乱码久久久久久蜜桃| 亚洲国产高清在线观看视频| 成人亚洲一区二区一| 欧美国产激情二区三区 | 亚洲免费色视频| 99久久精品免费看国产 | 一本久道久久综合中文字幕| 国产精品毛片久久久久久久| 国产一区二区三区四区五区入口 | 激情欧美一区二区| 亚洲精品一区二区在线观看| 国产制服丝袜一区| 欧美成人午夜电影| 国产一区久久久| 久久久99久久精品欧美| 狠狠色丁香婷综合久久| 久久精品亚洲精品国产欧美kt∨| 欧美大胆一级视频| 99久久久国产精品免费蜜臀| 色婷婷av一区| 亚洲一区在线视频观看| 在线观看91视频| 亚洲国产日韩一级| 欧美精品日韩一区| 久久99国产精品麻豆| 精品成人一区二区三区| 制服丝袜中文字幕一区| 蜜桃av一区二区三区电影| 精品国内片67194| 成人午夜碰碰视频| 一区二区日韩av| 在线播放国产精品二区一二区四区| 青青草伊人久久| 久久久高清一区二区三区| 99久久久免费精品国产一区二区| 一区二区三区鲁丝不卡| 欧美一区二区三区精品| 精品一区二区三区在线播放视频| 日本一区二区三区久久久久久久久不| www.在线成人| 亚洲成a人片在线观看中文| 日韩欧美一区在线| 丁香五精品蜜臀久久久久99网站| 亚洲久本草在线中文字幕| 7777精品伊人久久久大香线蕉超级流畅 | 国产又粗又猛又爽又黄91精品| 久久精品亚洲精品国产欧美kt∨ | 亚洲一区欧美一区| 欧美成人伊人久久综合网| 成人国产精品免费观看视频| 亚洲一级二级三级| 精品国产亚洲在线| 91久久精品网| 国产麻豆精品theporn| 一区二区视频在线| 日韩女优av电影在线观看| 99久久99久久精品国产片果冻| 天天影视网天天综合色在线播放| 久久九九影视网| 欧美午夜影院一区| 国产91清纯白嫩初高中在线观看 | 欧美人狂配大交3d怪物一区| 国产一区二区毛片| 亚洲一区在线观看免费观看电影高清 | 亚洲国产精品一区二区www在线 | 成人影视亚洲图片在线| 亚洲二区在线视频| 国产日本欧美一区二区| 555www色欧美视频| 成人av电影在线网| 美女脱光内衣内裤视频久久网站| 中文字幕一区二区三区四区 | 青青草国产精品亚洲专区无| 亚洲另类一区二区| 久久综合久色欧美综合狠狠| 欧美三级资源在线| 丁香激情综合国产| 美女视频网站久久| 一区二区三区日韩| 国产精品蜜臀在线观看| 日韩一区二区影院| 欧美在线观看一二区| 成人激情午夜影院| 美国毛片一区二区| 亚洲在线免费播放| 国产精品久久久久久久久果冻传媒 | 亚洲欧美日韩在线| 国产欧美在线观看一区| 日韩精品一区二区三区三区免费| 欧美三级视频在线观看| 不卡电影一区二区三区| 国内久久精品视频| 日韩成人一区二区| 亚洲一区二区视频在线| 日韩毛片视频在线看| 久久亚洲一区二区三区明星换脸 | 精品一区二区久久久| 爽爽淫人综合网网站| 一区二区三区在线看| 国产精品丝袜91| 久久久久久久久久久黄色| 日韩一区二区麻豆国产| 欧美日韩一区二区三区视频| 色综合久久久久| 91麻豆产精品久久久久久| 丁香婷婷综合色啪| 国产白丝网站精品污在线入口| 国精品**一区二区三区在线蜜桃| 免费高清成人在线| 日韩av在线播放中文字幕| 亚洲国产欧美一区二区三区丁香婷| 亚洲女同女同女同女同女同69| 国产精品成人免费精品自在线观看| 欧美激情综合五月色丁香| 国产三级精品视频| 欧美国产综合色视频| 欧美国产激情一区二区三区蜜月| 久久综合九色综合97_久久久| 日韩精品一区二区三区三区免费 | 国产美女精品在线| 国产美女在线观看一区| 国产馆精品极品| 国产成人在线色| 成人网页在线观看| 91视频在线看| 色婷婷久久久亚洲一区二区三区| 色久优优欧美色久优优| 欧美图片一区二区三区| 欧美卡1卡2卡| 欧美一区二区视频免费观看| 精品人伦一区二区色婷婷| 久久伊99综合婷婷久久伊| 国产日产欧美一区| 亚洲婷婷在线视频|