• Register
0 votes
291 views

Problem:

You use this method to determine the number of items stored in an ArrayList object?

5 3 2
7,520 points

Please log in or register to answer this question.

2 Answers

0 votes

Solution:

Size

6 4 3
14,580 points
0 votes
util. ArrayList to discover the length or size of ArrayList in Java. The size() strategy restores a whole number equivalent to various components present in the cluster list. It's not quite the same as the length of the cluster which is backing the ArrayList, that is known as the limit of ArrayList.
3 1
580 points

Related questions

1 vote
1 answer 5 views
5 views
Problem: Please help me to solve it out : you use this method to determine the number of items stored in an arraylist object
asked Apr 8 MUHAMMAD MUNEEB 83k points
0 votes
1 answer 3 views
3 views
Problem: I need to be able to print out the Student objects(all variables) in my array list. Is this possible? When I try to print it outputs this sort of thing e.g student.Student@82701e. I think it's hexadecimal or something This is my code: package student; ... public String getStudentNo() { return studentNo; } public String getEmail() { return email; } public int getYear() { return year; } }
asked Apr 23 Jack20 5.1k points
0 votes
1 answer 80 views
80 views
Problem: An ArrayList object automatically expands in size to accommodate the items stored in it? True False
asked Aug 4, 2020 ArifulIslam 7.5k points
1 vote
1 answer 185 views
185 views
Problem: I was handling the ArrayList in java and learning through my mistakes. Here I come to know that can I use an ArrayList class method to replace an item at a specific location in an ArrayList? If it is possible, please let me know the way or method which I can use to do this. Thanks
asked Mar 17, 2020 Gavin 15.3k points
0 votes
1 answer 23 views
23 views
Problem: I want to create a list of options for testing purposes. First of all, I did this: ArrayList<String> places = new ArrayList<String>(); places.add("Buenos Aires"); places.add("Córdoba"); places.add("La Plata"); Then I have refactored the code as follows: ArrayList ... > places = new ArrayList<String>( Arrays.asList("Buenos Aires", "Córdoba", "La Plata")); Is there a better way to do this?
asked Feb 14 sasha 16.2k points
0 votes
1 answer 5 views
5 views
Question: I've done some searching but I wasn't able to find a valid solution. I have an arraylist storing Strings such as gum, socks, OJ, dog food... I am having trouble iterating the list to determine the total number of differnt types of items. ie. ArrayList<String ... has 4 total items, but only three different kinds of items (Gum, Sucks, Candy). How would I design a method to calculate the 3?
asked Apr 15 munim01 21k points
0 votes
1 answer 27 views
27 views
Problem: How can I check whether a file exists, before opening it for reading in Java? Thanks in advance
asked Mar 5 ummesalma 29.2k points
0 votes
1 answer 23 views
23 views
Problem: I am trying to write a java program to create an ArrayList, add all the months of a year, and print the months. I have successfully written a program by initializing a string array with names of the months and then adding the months in ArrayList by using a for a loop. But I want to know, is there any efficient way of doing this? A demo program would be much helpful. Thanks!
asked Feb 28 Code Learner 9.9k points
0 votes
1 answer 27 views
27 views
Problem: Given an ArrayList a, write an expression that refers to the first element of the ArrayList?
asked Apr 12, 2020 ArifulIslam 7.5k points
0 votes
1 answer 26 views
26 views
Problem: How do I implement the following (Python pseudocode) in C++? if argv[1].startswith('--foo='): foo_value = int(argv[1][len('--foo='):]) (For example, if argv[1] is --foo=98, then foo_value is 98.)
asked Apr 23 Jack20 5.1k points