Homework 4 Due Date: January 26, 2010 This homework assignment is for you to practice implementing Immutable pattern. You will implement an immutable class – ImmutableIntegerArray – as defined in the following UML class diagram. You can implement the Integer type specified below as Java primitive type int or Integer class. You need to male sure that your getArray () does not return reference to the array stored in the ImmutableIntegerArray object. You can use clone () to achieve this. The changeArray() will return a new object of ImmutableIntegerArray which contains the exact same data except for the element in index will have the newValue . You also needs to implement a toString () which will print out the values of the array. Your main (client) program will do the following: 1. Create an instance of ImmutableIntegerArray by calling one of the constructors passing in the values of the array. 2.
This is the end of the preview.
access the rest of the document.