java - List or Collection: which one to use in interfaces? -


Assuming that I want a loose coupled interface, I often avoid using list implementation (such as ArrayList) in list signatures and I like to use the list.

Interface But as the archive is another general interface, do you think I should use the archive from the list?

Edit : I know the difference between the list and the collection. I do not care about the order or a list-specific feature, and this question is also about the return values ​​along with the method criteria.

A good API is required without highlighting unnecessary implementation details

I myself Using the list or determining the most. By changing the list or changing it with a collection, sometimes the API makes it really weird to use without any extra decoding or intangible offers.

I use Maps in the Mathri sign I try to avoid because I think input / output is very complex. This data can be solved by creating a specific wrapper class or by changing the location of the method so that the data has direct access. (For example, put it in the class in which you were passing the procedure).

Do not forget your object, to make sure that you do not receive some holy comb creator's sand, make life easier for those who maintain their code and those who call them. Generally there are many sensible ways to model the problem and what you choose depends on your own style and complexity of the expected future / code bases that are working on you.

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -