Can an object array be regarded as a collection of objects in Java?
The collection definition of Oracle site is:
A collection — sometimes called a container — is simply an object that groups multiple elements into a single unit.
I know Java provides Java util. Collection. It includes set, ArrayList, queue, etc
My question is: would I be wrong if I took an array of objects as a collection of objects? (although java.util.collection may not contain an array)
Editor: I found something interesting This is how Microsoft defines arrays and Collections: http://msdn.microsoft.com/en-sg/library/9ct4ey7x (v=vs.90). aspx
Solution
This is a bit like a semantic problem The word "set" in English may mean "more than one", so, yes, an array is a set However, in Java, you usually spell it collection, which contains the capital letter C, that is, Java util. Object of collection subtype In this regard, you cannot use arrays because arrays in java do not implement this interface