當前位置: 首頁>>代碼示例>>Java>>正文


Java Collections.checkedMap方法代碼示例

本文整理匯總了Java中java.util.Collections.checkedMap方法的典型用法代碼示例。如果您正苦於以下問題:Java Collections.checkedMap方法的具體用法?Java Collections.checkedMap怎麽用?Java Collections.checkedMap使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.util.Collections的用法示例。


在下文中一共展示了Collections.checkedMap方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: XPathType

import java.util.Collections; //導入方法依賴的package包/類
/**
 * Creates an <code>XPathType</code> instance with the specified XPath
 * expression, filter, and namespace map. The map is copied to protect
 * against subsequent modification.
 *
 * @param expression the XPath expression to be evaluated
 * @param filter the filter operation ({@link Filter#INTERSECT},
 *    {@link Filter#SUBTRACT}, or {@link Filter#UNION})
 * @param namespaceMap the map of namespace prefixes. Each key is a
 *    namespace prefix <code>String</code> that maps to a corresponding
 *    namespace URI <code>String</code>.
 * @throws NullPointerException if <code>expression</code>,
 *    <code>filter</code> or <code>namespaceMap</code> are
 *    <code>null</code>
 * @throws ClassCastException if any of the map's keys or entries are
 *    not of type <code>String</code>
 */
public XPathType(String expression, Filter filter,
    Map<String,String> namespaceMap) {
    if (expression == null) {
        throw new NullPointerException("expression cannot be null");
    }
    if (filter == null) {
        throw new NullPointerException("filter cannot be null");
    }
    if (namespaceMap == null) {
        throw new NullPointerException("namespaceMap cannot be null");
    }
    this.expression = expression;
    this.filter = filter;
    Map<String,String> tempMap = Collections.checkedMap(new HashMap<>(),
                                                        String.class,
                                                        String.class);
    tempMap.putAll(namespaceMap);
    this.nsMap = Collections.unmodifiableMap(tempMap);
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:37,代碼來源:XPathType.java

示例2: getObject

import java.util.Collections; //導入方法依賴的package包/類
protected Map<String, String> getObject() {
    Map<String, String> map = Collections.singletonMap("key", "value");
    return Collections.checkedMap(map, String.class, String.class);
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:5,代碼來源:java_util_Collections_CheckedMap.java

示例3: getAnotherObject

import java.util.Collections; //導入方法依賴的package包/類
protected Map<String, String> getAnotherObject() {
    Map<String, String> map = Collections.emptyMap();
    return Collections.checkedMap(map, String.class, String.class);
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:5,代碼來源:java_util_Collections_CheckedMap.java

示例4: CertificateRevokedException

import java.util.Collections; //導入方法依賴的package包/類
/**
 * Constructs a {@code CertificateRevokedException} with
 * the specified revocation date, reason code, authority name, and map
 * of extensions.
 *
 * @param revocationDate the date on which the certificate was revoked. The
 *    date is copied to protect against subsequent modification.
 * @param reason the revocation reason
 * @param extensions a map of X.509 Extensions. Each key is an OID String
 *    that maps to the corresponding Extension. The map is copied to
 *    prevent subsequent modification.
 * @param authority the {@code X500Principal} that represents the name
 *    of the authority that signed the certificate's revocation status
 *    information
 * @throws NullPointerException if {@code revocationDate},
 *    {@code reason}, {@code authority}, or
 *    {@code extensions} is {@code null}
 */
public CertificateRevokedException(Date revocationDate, CRLReason reason,
    X500Principal authority, Map<String, Extension> extensions) {
    if (revocationDate == null || reason == null || authority == null ||
        extensions == null) {
        throw new NullPointerException();
    }
    this.revocationDate = new Date(revocationDate.getTime());
    this.reason = reason;
    this.authority = authority;
    // make sure Map only contains correct types
    this.extensions = Collections.checkedMap(new HashMap<>(),
                                             String.class, Extension.class);
    this.extensions.putAll(extensions);
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:33,代碼來源:CertificateRevokedException.java

示例5: CertificateRevokedException

import java.util.Collections; //導入方法依賴的package包/類
/**
 * Constructs a {@code CertificateRevokedException} with
 * the specified revocation date, reason code, authority name, and map
 * of extensions.
 *
 * @param revocationDate the date on which the certificate was revoked. The
 *    date is copied to protect against subsequent modification.
 * @param reason the revocation reason
 * @param extensions a map of X.509 Extensions. Each key is an OID String
 *    that maps to the corresponding Extension. The map is copied to
 *    prevent subsequent modification.
 * @param authority the {@code X500Principal} that represents the name
 *    of the authority that signed the certificate's revocation status
 *    information
 * @throws NullPointerException if {@code revocationDate},
 *    {@code reason}, {@code authority}, or
 *    {@code extensions} is {@code null}
 * @throws ClassCastException if {@code extensions} contains an incorrectly
 *    typed key or value
 */
public CertificateRevokedException(Date revocationDate, CRLReason reason,
    X500Principal authority, Map<String, Extension> extensions) {
    if (revocationDate == null || reason == null || authority == null ||
        extensions == null) {
        throw new NullPointerException();
    }
    this.revocationDate = new Date(revocationDate.getTime());
    this.reason = reason;
    this.authority = authority;
    // make sure Map only contains correct types
    this.extensions = Collections.checkedMap(new HashMap<>(),
                                             String.class, Extension.class);
    this.extensions.putAll(extensions);
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:35,代碼來源:CertificateRevokedException.java

示例6: XPathFilterParameterSpec

import java.util.Collections; //導入方法依賴的package包/類
/**
 * Creates an <code>XPathFilterParameterSpec</code> with the specified
 * XPath expression and namespace map. The map is copied to protect against
 * subsequent modification.
 *
 * @param xPath the XPath expression to be evaluated
 * @param namespaceMap the map of namespace prefixes. Each key is a
 *    namespace prefix <code>String</code> that maps to a corresponding
 *    namespace URI <code>String</code>.
 * @throws NullPointerException if <code>xPath</code> or
 *    <code>namespaceMap</code> are <code>null</code>
 * @throws ClassCastException if any of the map's keys or entries are not
 *    of type <code>String</code>
 */
public XPathFilterParameterSpec(String xPath, Map<String,String> namespaceMap) {
    if (xPath == null || namespaceMap == null) {
        throw new NullPointerException();
    }
    this.xPath = xPath;
    Map<String,String> tempMap = Collections.checkedMap(new HashMap<>(),
                                                        String.class,
                                                        String.class);
    tempMap.putAll(namespaceMap);
    this.nsMap = Collections.unmodifiableMap(tempMap);
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:26,代碼來源:XPathFilterParameterSpec.java


注:本文中的java.util.Collections.checkedMap方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。