- 时间:2020-11-23 21:14 编辑: 来源: 阅读:
- 扫一扫,手机访问
摘要:最最常用的 100 个 Java类分享
大部分的 Java 软件开发都会使用到各种不同的库。近日我们从一万个开源的 Java 项目中进行分析,从中提取出最常用的 Java 类,这些类有来自于 Java 的标准库,也有第三方库。每个类在同一个项目中只计数一次,下面的列表中显示前 100 名的类。
以下列表中按使用最多的类进行排序,第三个数值表示 10000 个项目里使用到该类的项目数,而完整的列表请看 [url=http://www.programcreek.com/java-api-examples/?action=index][i]here[/i][/url].
[list=1]
[*]
[url=http://www.programcreek.com/java-api-examples/index.php?api=java.util.ArrayList]java.util.ArrayList [/url](6958)
[/*]
[*]
[url=http://www.programcreek.com/java-api-examples/index.php?api=java.io.IOException]java.io.IOException [/url](6866)
[/*]
[*]
[url=http://www.programcreek.com/java-api-examples/index.php?api=java.util.List]java.util.List [/url](6784)
[/*]
[*]
[url=http://www.programcreek.com/java-api-examples/index.php?api=java.util.HashMap]java.util.HashMap [/url](5590)
[/*]
[*]
[url=http://www.programcreek.com/java-api-examples/index.php?api=java.util.Map]java.util.Map [/url](5413)
[/*]
[*]
[url=http://www.programcreek.com/java-api-examples/index.php?api=java.io.File]java.io.File [/url](5097)
[/*]
[*]
[url=http://www.programcreek.com/java-api-examples/index.php?api=java.io.InputStream]java.io.InputStream [/url](4234)
[/*]
[*]
[url=http://www.programcreek.com/java-api-examples/index.php?api=java.util.Set]java.util.Set [/url](3915)
[/*]
[*]
[url=http://www.programcreek.com/java-api-examples/index.php?api=java.util.Arrays]java.util.Arrays [/url](3884)
[/*]
[*]
[url=http://www.programcreek.com/java-api-examples/index.php?api=java.util.Iterator]java.util.Iterator [/url](3856)
[/*]
[*]
[url=http://www.programcreek.com/java-api-examples/index.php?api=java.util.Collections]java.util.Collections [/url](3643)
[/*]
[*]
[url=http://www.programcreek.com/java-api-examples/index.php?api=java.util.Date]java.util.Date [/url](3461)
[/*]
[*]
[url=http://www.programcreek.com/java-api-examples/index.php?api=java.util.HashSet]java.util.HashSet [/url](3278)
[/*]
[*]
[url=http://www.programcreek.com/java-api-examples/index.php?api=java.io.BufferedReader]java.io.BufferedReader [/url](3257)
[/*]
[*]
[url=http://www.programcreek.com/java-api-examples/index.php?api=java.util.Collection]java.util.Collection [/url](3192)
[/*]
[*]
[url=http://www.programcreek.com/java-api-examples/index.php?api=java.net.URL]java.net.URL [/url](3168)
[/*]
[*]
[url=http://www.programcreek.com/java-api-examples/index.php?api=java.io.FileInputStream]java.io.FileInputStream [/url](3044)
[/*]
[*]
[url=http://www.programcreek.com/java-api-examples/index.php?api=java.io.InputStreamReader]java.io.InputStreamReader [/url](3023)
[/*]
[*]
[url=http://www.programcreek.com/java-api-examples/index.php?api=org.junit.Test]org.junit.Test [/url](3008)
[/*]
[*]
[url=http://www.programcreek.com/java-api-examples/index.php?api=java.io.FileOutputStream]java.io.FileOutputStream [/url](2843)
[/*]
[*]
[url=http://www.programcreek.com/java-api-examples/index.php?api=java.io.FileNotFoundException]java.io.FileNotFoundException [/url](2669)
[/*]
[*]
[url=http://www.programcreek.com/java-api-examples/index.php?api=java.io.OutputStream]java.io.OutputStream [/url](2563)
[/*]
[*]
[url=http://www.programcreek.com/java-api-examples/index.php?api=java.util.regex.Pattern]java.util.regex.Pattern [/url](2469)
[/*]
[*]
[url=http://www.programcreek.com/java-api-examples/index.php?api=java.io.Serializable]java.io.Serializable [/url](2437)
[/*]
[*]
[url=http://www.programcreek.com/java-api-examples/index.php?api=java.util.LinkedList]java.util.LinkedList [/url](2372)
[/*]
[*]
[url=http://www.programcreek.com/java-api-examples/index.php?api=java.text.SimpleDateFormat]java.text.SimpleDateFormat [/url](2245)
[/*]
[*]
[url=http://www.programcreek.com/java-api-examples/index.php?api=java.util.Properties]java.util.Properties [/url](2190)
[/*]
[*]
[url=http://www.programcreek.com/java-api-examples/index.php?api=java.util.Random]java.util.Random [/url](2171)
[/*]
[*]
[url=http://www.programcreek.com/java-api-examples/index.php?api=java.lang.reflect.Method]java.lang.reflect.Method [/url](2141)
[/*]
[*]
[url=http://www.programcreek.com/java-api-examples/index.php?api=java.io.ByteArrayOutputStream]java.io.ByteArrayOutputStream [/url](2112)
[/*]
[*]
[url=http://www.programcreek.com/java-api-examples/index.php?api=java.util.regex.Matcher]java.util.regex.Matcher [/url](2012)
[/*]
[*]
[url=http://www.programcreek.com/java-api-examples/index.php?api=android.os.Bundle]android.os.Bundle [/url](2007)
[/*]
[*]
[url=http://www.programcreek.com/java-api-examples/index.php?api=java.util.logging.Logger]java.util.logging.Logger [/url](1999)
[/*]
[*]
[url=http://www.programcreek.com/java-api-examples/index.php?api=java.io.UnsupportedEncodingException]java.io.UnsupportedEncodingException [/url](1968)
[/*]
[*]
[url=http://www.programcreek.com/java-api-examples/index.php?api=org.junit.Before]org.junit.Before [/url](1920)
[/*]
[*]
[url=http://www.programcreek.com/java-api-examples/index.php?api=java.util.Comparator]java.util.Comparator [/url](1896)
[/*]
[*]
[url=http://www.programcreek.com/java-api-examples/index.php?api=java.io.ByteArrayInputStream]java.io.ByteArrayInputStream [/url](1868)
[/*]
[*]
[url=http://www.programcreek.com/java-api-examples/index.php?api=java.io.PrintWriter]java.io.PrintWriter [/url](1862)
[/*]
[*]
[url=http://www.programcreek.com/java-api-examples/index.php?api=java.util.Calendar]java.util.Calendar [/url](1854)
[/*]
[*]
[url=http://www.programcreek.com/java-api-examples/index.php?api=android.app.Activity]android.app.Activity [/url](1843)
[/*]
[*]
[url=http://www.programcreek.com/java-api-examples/index.php?api=java.net.MalformedURLException]java.net.MalformedURLException [/url](1828)
[/*]
[*]
[url=http://www.programcreek.com/java-api-examples/index.php?api=android.content.Context]android.content.Context [/url](1780)
[/*]
[*]
[url=http://www.programcreek.com/java-api-examples/index.php?api=android.view.View]android.view.View [/url](1731)
[/*]
[*]
[url=http://www.programcreek.com/java-api-examples/index.php?api=java.util.Locale]java.util.Locale [/url](1719)
[/*]
[*]
[url=http://www.programcreek.com/java-api-examples/index.php?api=java.util.Enumeration]java.util.Enumeration [/url](1709)
[/*]
[*]
[url=http://www.programcreek.com/java-api-examples/index.php?api=java.util.Map.Entry]java.util.Map.Entry [/url](1705)
[/*]
[*]
[url=http://www.programcreek.com/java-api-examples/index.php?api=java.io.FileWriter]java.io.FileWriter [/url](1677)
[/*]
[*]
[url=http://www.programcreek.com/java-api-examples/index.php?api=java.io.FileReader]java.io.FileReader [/url](1651)
[/*]
[*]
[url=http://www.programcreek.com/java-api-examples/index.php?api=android.util.Log]android.util.Log [/url](1614)
[/*]
[*]
[url=http://www.programcreek.com/java-api-examples/index.php?api=android.content.Intent]android.content.Intent [/url](1601)
[/*]
[*]
[url=http://www.programcreek.com/java-api-examples/index.php?api=java.lang.reflect.InvocationTargetException]java.lang.reflect.InvocationTargetException [/url](1594)
[/*]
[*]
[url=http://www.programcreek.com/java-api-examples/index.php?api=java.util.logging.Level]java.util.logging.Level [/url](1557)
[/*]
[*]
[url=http://www.programcreek.com/java-api-examples/index.php?api=java.lang.reflect.Field]java.lang.reflect.Field [/url](1499)
[/*]
[*]
[url=http://www.programcreek.com/java-api-examples/index.php?api=java.io.StringWriter]java.io.StringWriter [/url](1499)
[/*]
[*]
[url=http://www.programcreek.com/java-api-examples/index.php?api=android.widget.TextView]android.widget.TextView [/url](1442)
[/*]
[*]
[url=http://www.programcreek.com/java-api-examples/index.php?api=java.util.LinkedHashMap]java.util.LinkedHashMap [/url](1409)
[/*]
[*]
[url=http://www.programcreek.com/java-api-examples/index.php?api=java.io.Reader]java.io.Reader [/url](1390)
[/*]
[*]
[url=http://www.programcreek.com/java-api-examples/index.php?api=java.net.URI]java.net.URI [/url](1377)
[/*]
[*]
[url=http://www.programcreek.com/java-api-examples/index.php?api=java.io.Writer]java.io.Writer [/url](1339)
[/*]
[*]
[url=http://www.programcreek.com/java-api-examples/index.php?api=java.text.ParseException]java.text.ParseException [/url](1318)
[/*]
[*]
[url=http://www.programcreek.com/java-api-examples/index.php?api=junit.framework.TestCase]junit.framework.TestCase [/url](1318)
[/*]
[*]
[url=http://www.programcreek.com/java-api-examples/index.php?api=java.io.OutputStreamWriter]java.io.OutputStreamWriter [/url](1295)
[/*]
[*]
[url=http://www.programcreek.com/java-api-examples/index.php?api=java.io.StringReader]java.io.StringReader [/url](1279)
[/*]
[*]
[url=http://www.programcreek.com/java-api-examples/index.php?api=java.io.BufferedWriter]java.io.BufferedWriter [/url](1265)
[/*]
[*]
[url=http://www.programcreek.com/java-api-examples/index.php?api=java.util.Vector]java.util.Vector [/url](1254)
[/*]
[*]
[url=http://www.programcreek.com/java-api-examples/index.php?api=java.util.StringTokenizer]java.util.StringTokenizer [/url](1251)
[/*]
[*]
[url=http://www.programcreek.com/java-api-examples/index.php?api=java.text.DateFormat]java.text.DateFormat [/url](1246)
[/*]
[*]
[url=http://www.programcreek.com/java-api-examples/index.php?api=java.util.concurrent.TimeUnit]java.util.concurrent.TimeUnit [/url](1237)
[/*]
[*]
[url=http://www.programcreek.com/java-api-examples/index.php?api=java.io.BufferedInputStream]java.io.BufferedInputStream [/url](1235)
[/*]
[*]
[url=http://www.programcreek.com/java-api-examples/index.php?api=java.util.TreeMap]java.util.TreeMap [/url](1227)
[/*]
[*]
[url=http://www.programcreek.com/java-api-examples/index.php?api=org.xml.sax.SAXException]org.xml.sax.SAXException [/url](1218)
[/*]
[*]
[url=http://www.programcreek.com/java-api-examples/index.php?api=javax.servlet.http.HttpServletRequest]javax.servlet.http.HttpServletRequest [/url](1175)
[/*]
[*]
[url=http://www.programcreek.com/java-api-examples/index.php?api=java.io.PrintStream]java.io.PrintStream [/url](1168)
[/*]
[*]
[url=http://www.programcreek.com/java-api-examples/index.php?api=java.util.TreeSet]java.util.TreeSet [/url](1160)
[/*]
[*]
[url=http://www.programcreek.com/java-api-examples/index.php?api=android.widget.Toast]android.widget.Toast [/url](1157)
[/*]
[*]
[url=http://www.programcreek.com/java-api-examples/index.php?api=java.util.Hashtable]java.util.Hashtable [/url](1154)
[/*]
[*]
[url=http://www.programcreek.com/java-api-examples/index.php?api=java.lang.reflect.Constructor]java.lang.reflect.Constructor [/url](1139)
[/*]
[*]
[url=http://www.programcreek.com/java-api-examples/index.php?api=java.net.URLEncoder]java.net.URLEncoder [/url](1134)
[/*]
[*]
[url=http://www.programcreek.com/java-api-examples/index.php?api=java.security.NoSuchAlgorithmException]java.security.NoSuchAlgorithmException [/url](1134)
[/*]
[*]
[url=http://www.programcreek.com/java-api-examples/index.php?api=org.w3c.dom.Document]org.w3c.dom.Document [/url](1130)
[/*]
[*]
[url=http://www.programcreek.com/java-api-examples/index.php?api=android.widget.Button]android.widget.Button [/url](1129)
[/*]
[*]
[url=http://www.programcreek.com/java-api-examples/index.php?api=org.junit.After]org.junit.After [/url](1128)
[/*]
[*]
[url=http://www.programcreek.com/java-api-examples/index.php?api=javax.servlet.http.HttpServletResponse]javax.servlet.http.HttpServletResponse [/url](1109)
[/*]
[*]
[url=http://www.programcreek.com/java-api-examples/index.php?api=java.awt.Color]java.awt.Color [/url](1099)
[/*]
[*]
[url=http://www.programcreek.com/java-api-examples/index.php?api=java.net.URISyntaxException]java.net.URISyntaxException [/url](1085)
[/*]
[*]
[url=http://www.programcreek.com/java-api-examples/index.php?api=javax.servlet.ServletException]javax.servlet.ServletException [/url](1081)
[/*]
[*]
[url=http://www.programcreek.com/java-api-examples/index.php?api=javax.xml.parsers.DocumentBuilderFactory]javax.xml.parsers.DocumentBuilderFactory [/url](1076)
[/*]
[*]
[url=http://www.programcreek.com/java-api-examples/index.php?api=java.lang.annotation.Retention]java.lang.annotation.Retention [/url](1075)
[/*]
[*]
[url=http://www.programcreek.com/java-api-examples/index.php?api=java.security.MessageDigest]java.security.MessageDigest [/url](1072)
[/*]
[*]
[url=http://www.programcreek.com/java-api-examples/index.php?api=java.util.concurrent.Executors]java.util.concurrent.Executors [/url](1062)
[/*]
[*]
[url=http://www.programcreek.com/java-api-examples/index.php?api=java.net.UnknownHostException]java.net.UnknownHostException [/url](1057)
[/*]
[*]
[url=http://www.programcreek.com/java-api-examples/index.php?api=org.slf4j.Logger]org.slf4j.Logger [/url](1054)
[/*]
[*]
[url=http://www.programcreek.com/java-api-examples/index.php?api=java.sql.SQLException]java.sql.SQLException [/url](1043)
[/*]
[*]
[url=http://www.programcreek.com/java-api-examples/index.php?api=org.slf4j.LoggerFactory]org.slf4j.LoggerFactory [/url](1042)
[/*]
[*]
[url=http://www.programcreek.com/java-api-examples/index.php?api=java.util.UUID]java.util.UUID [/url](1040)
[/*]
[*]
[url=http://www.programcreek.com/java-api-examples/index.php?api=java.net.InetAddress]java.net.InetAddress [/url](1026)
[/*]
[*]
[url=http://www.programcreek.com/java-api-examples/index.php?api=junit.framework.Assert]junit.framework.Assert [/url](1011)
[/*]
[*]
[url=http://www.programcreek.com/java-api-examples/index.php?api=android.view.ViewGroup]android.view.ViewGroup [/url](1005)
[/*]
[*]
[url=http://www.programcreek.com/java-api-examples/index.php?api=java.util.concurrent.ConcurrentHashMap]java.util.concurrent.ConcurrentHashMap [/url](1001)
[/*]
[*]
[url=http://www.programcreek.com/java-api-examples/index.php?api=java.awt.event.ActionEvent]java.awt.event.ActionEvent [/url](995)
[/*]
[/list]
上表中,一点也不奇怪,有 85 个是 Java 的标准库,因为这是语言本身的一部分,涉及 util、lang 和 io 包。
下图是包使用的分布图:
[img]http://img.1sucai.cn/uploads/article/2018010710/20180107100136_0_2259.jpg[/img]
该调查是分析源码文件中的 import 语句,因此你并没有发现大量的 String, Math, StringBuilder 等类,所以没必要对它们进行排除。
via [url=http://www.programcreek.com/2014/09/top-100-classes-used-in-java-projects/]programcreek[/url]