本文整理汇总了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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}