Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9118123
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T05:04:09+00:00 2026-06-17T05:04:09+00:00

Hopefully this is not a duplicate. Before anything, I know ArrayList are not the

  • 0

Hopefully this is not a duplicate.

Before anything, I know ArrayList are not the best choice but this is just curiosity.

Simply, I was wondering about the implementation of ArrayList. I looked and figured out it uses an array for storage.

For array, when you have:

int [] arr;

arr points to the first element of the array and because it is typed as integer, the compiler knows where to jump:

arr[2] => arr value + 2 * typeof(int) = address of arr[2]

Now, since ArrayList are typeless, I was wondering how the compiler can figure out where is the next item. I would guess there is an overhead that tells what is the data so that the compiler can perform the pointer arithmetic.

As a result, ArrayList should be way slower than any other typed collection since it cannot just jump to the data as it needs to know what is before. This would be quite similar to LinkedList.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T05:04:10+00:00Added an answer on June 17, 2026 at 5:04 am

    An ArrayList only contain references to the objects, not the objects themselves. All references are the same size, so the problem doesn’t exist.

    The internal type of the reference is surely object.

    For generic arrays of value types, the actual value is stored in the array and the size of the element is used as you describe. If you put a value type in an ArrayList it will be boxed into an object and the reference to that object is stored in the ArrayList.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hopefully this has not been asked/answered before, but I haven't found anything that fits
hopefully this doesn't sound ridiculous, but are some parts of the web.config not required
Hello! I'm not even sure if this is possible, but hopefully it is in
Hopefully this is just a stupid mistake, but I can't see it. ; OK
Hopefully this explanation will make sense, but what is the best way (if it
Hopefully this is a simple one, but not sure if it will be as
This is pretty much a duplicate of this unanswered question , but hopefully someone
Hopefully this will not come across as a silly or pedantic question, but I'm
Hopefully this isn't a dupe, couldn't find anything related online I'm getting a strange
Hopefully this isn't a duplicate. I tried to search for an answer to my

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.