Comment on Tutorial - How to use ArrayList in Java By Hong
Comment Added by : alex
Comment Added at : 2010-06-13 05:35:34
Comment on Tutorial : How to use ArrayList in Java By Hong
Great Post! Thanks alot.
I 'm searching for a way to sum up the Values of a HashTable<String, Integer>
The Method you mentioned above
// get array
Object ia = al.toArray();
int sum = 0;
// sum the array
for(int i=0; i<ia.length; i++)
sum += ((Integer) ia[i]).intValue();
System.out.println("Sum is: " + sum);
is fine for ArrayLists but i cant get it work on HashMaps.
Any ideas how this could be done ?
- Data Science
- Cloud Computing
- Java Beans
- Mac OS X
- Office 365
- Tech Reviews
Subscribe to Tutorials
2. Abstract class example is good, What is the differ
View Tutorial By: megakumar at 2011-04-10 04:15:10
3. to get more and clear information about java progr
View Tutorial By: SWARNA at 2010-09-13 04:23:10
4. Error loading SolarisSerial: java.lang.Unsatisfied
View Tutorial By: koteshwar at 2011-02-05 05:33:19
7. Simple and to the point. Thanks for this tutorial.
View Tutorial By: Balvinder at 2008-08-03 04:40:05
9. i have connected my phone through bluetooth and us
View Tutorial By: nikitha at 2013-02-05 09:07:34