当前位置: 首页>>代码示例>>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;未经允许,请勿转载。