Reputation: 450
I am creating a Java object which will contain an ordered array of elements. The API allows the user to add elements to that array and to retrieve all elements currently in the array only.
I am creating a new class as there are several additional properties that I want this list to have which, as far as I can see, do not exist in other standard implementations. (I won't go into detail as to what these properties are as they are superfluous to the question I want to ask).
In addition, I do not want to implement the List interface (or even Collection) as then I would have to implement a lot of methods that are not necessary. Adding elements and retrieving all elements are all the user should be able to do.
Is it acceptable to end the name of this class with 'List'? "MyStupidList? or would that cause users to believe that my class implements List? What other word should I use instead that implies a list or collection without using those words?
Upvotes: 0
Views: 83
Reputation:
Yes
It is totally acceptable. It's mostly up to user preferences. If you're not going to share the code with anyone nor plan to have open source, it does not matter, do it your way. However if you do plan to share the code somehow, you might consider renaming it to something unique just for eye candy.
According to Oracle "Try to keep your class names simple and descriptive" which proves it's okay for a class name to end with "List" as it is descriptive. As long as the class name begins with an uppercase letter. Though it might lead to confusion to contain List in the name for some users, but it is indeed acceptable.
Upvotes: 1