Link to home
Start Free TrialLog in
Avatar of Jay Roy
Jay RoyFlag for United States of America

asked on

limit of arraylist

hi guys
Can anyone tell me what is the max limit of arraylist and hashmap.

I will have incoming streaming data. I will convert the streaming data into object and add into a ArrayList.

What is the overhead if any? and what is the maximum capacity the ArrayList can hold?

Thanks
SOLUTION
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
There is no limit, but memory will limit you
Size variable in the arrayList is of type int.

So, it should store max of INT_MAX_VALUE.

But its not a good practice to store that much data in memory.
>>What is the overhead if any?

You should probably think of persisting the data to some kind of database or filesystem.
Also when it becomes long then advanrtages over arrays, such as  say such thinsg as contains() method
bocome slow
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Jay Roy

ASKER

>>You should probably think of persisting the data to some kind of database or filesystem.

ehcahce could be an option i think.
but i need to use ArrayList because of compatibility issues with my front-end. I am using Adobe Flex in the front end and Flex has nice support for java ArrayList.
I thought of using EHcache but i have two issues
Is EHcache similar to ArrayList ? They both store objects in memory ?
Flex is compatible with ArrayList but may not be compatibe with EhCahce.

thanks all for the quick answers.
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Jay Roy

ASKER

The data in the arraylist needs to be shown
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Jay Roy

ASKER

>>Can the front end shows that many elements at a time? UI should have some kind of pagination functionality.
yes thats true. We do have pagination on the UI

thanks.
When you have pagination, you should read only the max number of elements that can be shown on UI.