Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Data Structure used by Java array.

 
Fidel Edwards
Ranch Hand
Posts: 234
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Friends,


Can any body tell me which Data Structure used by Java Array internally. As far as I know, Array is a data structure itself. Please correct me if I am wrong.



Thanks in advance!
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ashish Tiwari wrote:Array is a data structure itself.


Yes. it is a Linear Data Structure
 
Ulrika Tingle
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ashish Tiwari wrote:
Can any body tell me which Data Structure used by Java Array internally. As far as I know, Array is a data structure itself. Please correct me if I am wrong.


And what will be your next question? What data structure is the data structure using that Java arrays use internally?

It never ends and it doesn't matter really. You can take for granted that Java arrays end up being efficiently implemented using a piece of contigous memory. In fact, the existence of contiguous random access memory was what inspired the array data structure in the first place.

If this doesn't satisfy your curiosity you can of course look at the bytecode emitted by a Java compiler. Just write some Java code using an array and study the bytecode. This will show how the Java array is mapped on a bytecode array. But this again raises the question of what does the JVM do with this bytecode when it runs it on a specific computer?
 
Fidel Edwards
Ranch Hand
Posts: 234
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ulrika Tingle wrote:
In fact, the existence of contiguous random access memory was what inspired the array data structure in the first place.



Thanks Ulrika & Seetharaman

Thanks a lot !
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic