CSC/ECE 517 Summer 2008/wiki1 6 arraysandhashes: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
Line 12: Line 12:
==== Identifying Arrays ====
==== Identifying Arrays ====
==== Adding Elements ====
==== Adding Elements ====
==== Removing Elements ====
==== Splicing Elements ====
==== Sorting Elements ====
==== Sorting Elements ====
==== Multidimensional Arrays ====
==== Multidimensional Arrays ====

Revision as of 17:49, 29 May 2008

Arrays and Hashes

Arrays and hashes are built into Ruby. Arrays, of course, are built into Java too, but hashes are only available through library classes. Compare Ruby and Java arrays, as well as hashes. Write equivalent code sequences in the two languages that illustrate the convenience of programming these constructs in both languages.

Arrays

While Java and Ruby both provide built-in support for arrays, they differ in the operations that can be performed on them.

Comparison of Common Operations in Ruby and Java

Creating an Array

Identifying Arrays

Adding Elements

Removing Elements

Splicing Elements

Sorting Elements

Multidimensional Arrays

Hashes

Back to the assignment page