Are there some statistics on the most frequently used Java API functions? [closed]

Given a large API (an in particular, the Java or J2EE standard libraries), is there a tool or search engine or other resource that can tells me which methods, classes, or even packages people in general tend to use the most? I am annotating (see below) APIs and would like to focus my attention on popular areas. The only thing I can think of is using google code with different method names but that is of course tedious.

Some background (if anyone is interested): As part of my PhD research I've developed a tool that allows users to highlight important "directives" in method documentation (their own or in existing APIs) and then pushes these annotations to users to increase chances that they become aware of it. Our lab studies show that this has potential, but to get people to use it in the field I have to provide "corpuses" of annotated APIs and I'm trying to prioritize which libraries to annotate.

Asked by: Justin354 | Posted: 23-01-2022

Answer 1

I wouldn't know if such statistics are even feasible, but I think a pretty safe bet would be to start with the basics plus some famous third party libraries. For example:

As for third parties

Answered by: Dexter482 | Posted: 24-02-2022

Answer 2

This "simple" bash script will count most used classes in your current project codebase.

find . -name "*.java" | xargs cat | grep "^import java" |  sort | uniq -c | sort -nr | head -100

Answered by: Anna927 | Posted: 24-02-2022

Answer 3

It seems like it would be possible to automate a process where a list of J2SE or J2EE packages could be submitted to, Google Code or another open source code search repository, count the results per package and sort for the most popular.

Note that this won't give you absolutely complete results, as java.lang (or any other package/class that is implicitly imported) won't show up in that search.

I don't think there is an existing tool or publisher of this information, although I could be mistaken.

Another possibility is to pick a number of 'representative' projects, download them and use a dependency analysis tool, like JDepend, to generate dependency reports and process them to get a set of packages/classes in use.

Answered by: Victoria435 | Posted: 24-02-2022

Answer 4

I presume, you want to rank them on basis of frequency of usage. I would suggest you download some open source java projects, run a static analysis tool. Then on the same set run a memory profiler and finally extrapolate these statistics

Answered by: John236 | Posted: 24-02-2022

Answer 5

You can use the MethodRank metric for that, to detect most used methods,classes inside some open source projects.

You can get the Trial version of JavaDepend, analyze some popular java open source projects, and execute some CQL requests (like SQL) to get all most used methods, classes, fields inside these projects.

PS: The Trial version is sufficient for your need, there's no time limitation.

Answered by: Patrick471 | Posted: 24-02-2022

Similar questions

java - How to get access to the Hibernate Statistics

So in my persistence.xml I turned on hibernate.generate_statistics. <property name="hibernate.generate_statistics">true</property> My question is how do I access them? Where do the statistics go?

How to display X-Bar statistics symbol in Java Swing label?

What's the best way to insert statistics symbols in a JLabel's text? For example, the x-bar? I tried assigning the text field the following with no success: <html>x̄

linux - How can i monitor system statistics in kubuntu using Java?

i am doing a project related to configuration and memory analyzer for kubuntu. i want to display the system statistics information like CPU usage, RAM usage and proceses etc. graphically using an odometer. i wanted to know if there is any great open source library for graphical component like odometers and other graphing utilities. also another problem is that i have to get information of cpu from somewhere and parse it a...

java - Getting code statistics from big projects

I'm interested in code statistics tools. Specifically I need to get statistics on Java EE code, but any code analyzer would do. Should I start creating one of my own or is there some project that you have used? ex. LOC, number of classes , libs ... What is your experience ?

java - Network statistics

I'm trying to collect network statistics on my computer and draw a pie chart. An example is shown below. my computer connects to port 80 75% my computer connects to port 443 20% my computer connects to port 443 5% But I don't know how to get each port that my machine is connecting to. I will be using Java to develop this.

java - Hadoop - job statistics

I used hadoop to run map-reduce applications on our cluster. The jobs take around 10 hours to complete daily. I want to know the time taken for each job, and the time taken by the longest job, that I can optimize those jobs. Is there any plugin or script that does this? Thank you Bala

java - Overall build statistics from Bamboo server

I am trying to use Bamboo's remote API to extract some statistics. It looks like it doesn't support extensive reporting. All I got was a way to get the most recent builds. What I need is a list of all builds (maybe up to a numerical limit) or at least the count of successful/failed builds so far, is this available anywhere? any other ideas on how to get this information? Here is the Bamboo documentation for remote ...

Is there a Java library that enables gathering UI usage statistics?

Is there a Java library that enables gathering UI usage statistics? Something that feels like log4j?

statistics - Arima/Arma Time series Models in Java

Closed. This question does not meet Stack Overflow guid...

Java version statistics

Where can I see statistics about the most used Java versions? (I want to develop applications that will run on most systems)

Still can't find your answer? Check out these amazing Java communities for help...

Java Reddit Community | Java Help Reddit Community | Java Community | Java Discord | Java Programmers (Facebook) | Java developers (Facebook)