0

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?

2

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 GetThreadsCount.

As per the comment by JavaLatte, here is an example of when it is appropriate to name a method GetThreadCounts.

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.
1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.