how do i use the size() method to get the number of elements in a collection?
size() method of the Collection class
Collapse
X
-
Suppose I have a collection:[code=java]Originally posted by veremuehow do i use the size() method to get the number of elements in a collection?
Collection c= ...; // however I put elements in it[/code]
Does the following come as a surprise?[code=java]
int cSize= c.size();[/code]
Read the API documentation, it helps a lot.
kind regards,
Jos
Comment