I've seen a lot of
GetThreadCounts() used in some 3rd party libraries, to get number of threads. But I also saw some use
GetThreadCount()? Which one is correct? Do they both make sense?
If the result is a single number then
GetThreadCount is correct. If it returns a collection of numbers then
GetThreadCounts is correct. It is the number of results that determines singular/plural, not the number of items in the source data (number of threads).
Another suitable (but not commonly seen) variation would be
As per the comment by JavaLatte, here is an example of when it is appropriate to name a method
getThreadCounts CountData getThreadCounts() Returns the number of threads in the application over time. NOTE If running in "event only" mode, this data will always return an empty array. This is because "event only" does not store any data to inquire on. Instead, you need to use the api calls to register listeners and get notification of when events occur Returns: an array of CountData objects. Each object contains a time and the number of threads that were in the monitored application at that time.