Map已知实现类概述
本文概述以下Map实现类,其中ConcurrentHashMap请转步到
浅读java.util.Map及其实现类(三)
AbstractMap
Attributes
AuthProvider
ConcurrentHashMap
ConcurrentSkipListMap
EnumMap
HashMap
Hashtable
IdentityHashMap
Attributes
AuthProvider
ConcurrentHashMap
ConcurrentSkipListMap
EnumMap
HashMap
Hashtable
IdentityHashMap
LinkedHashMap
PrinterStateReasons
Properties
PrinterStateReasons
Properties
AbstractMap
标签:抽象Map
概述:一个实现map的抽象类,提供各类一些基础的实现
以下类都是他的子类
ConcurrentHashMap / ConcurrentSkipListMap / EnumMap / HashMap / IdentityHashMap / TreeMap / WeakHashMap
以下类都是他的子类
ConcurrentHashMap / ConcurrentSkipListMap / EnumMap / HashMap / IdentityHashMap / TreeMap / WeakHashMap
从AbstractMap源码中可以看到put及AbstractMap.SimpleImmutableEntry中setValue(V value)是不支持的method我们需要自己来实现这部分功能
entrySet是需要自己实现的,其中TreeMap等都对他进行了实现
Attributes
标签:MANIFEST.MF读取 非线程安全
概述: 用来读取jar中MANIFEST.MF的文件,UTF-8输出编码
public static void main(String[] args) {
String s = "e:\\commons-dbcp-1.3.jar";
JarInputStream ji = null;
try {
//jarInputStream与attributes都是在java.util.jar包
ji = new JarInputStream(new FileInputStream(s));
Manifest mf = ji.getManifest();
mf.getMainAttributes().forEach((k, v) -> System.out.println("[ k:" + k + "/" + "v:" + v + " ]"));
} catch (Exception e) {
e.printStackTrace();
} finally {
if (ji != null)
try {
ji.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
[ k:Bundle-License/v:http://www.apache.org/licenses/LICENSE-2.0.txt ]
[ k:Bundle-SymbolicName/v:org.apache.commons.dbcp ]
[ k:Archiver-Version/v:Plexus Archiver ]
[ k:Built-By/v:philsteitz ]
[ k:Bnd-LastModified/v:1265564429985 ]
[ k:Implementation-Vendor-Id/v:org.apache ]
[ k:Specification-Title/v:Commons DBCP ]
[ k:Bundle-DocURL/v:http://commons.apache.org/dbcp/ ]
[ k:Import-Package/v:javax.naming,javax.naming.spi,javax.sql,javax.transaction,javax.transaction.xa,org.apache.commons.dbcp;version="1.3",org.apache.commons.dbcp.cpdsadapter;version="1.3",org.apache.commons.dbcp.datasources;version="1.3",org.apache.commons.dbcp.managed;version="1.3",org.apache.commons.jocl;version="1.3",org.apache.commons.pool,org.apache.commons.pool.impl,org.xml.sax,org.xml.sax.helpers ]
[ k:Export-Package/v:org.apache.commons.jocl;version="1.3",org.a