# Designing a simple List class

Java provided the ArrayList class as part of the standard libraries (it uses generics, so you write things like List<String> l = new ArrayList<String>();, but we haven't talked about generics yet).

This exercise is designing a simple version of ArrayList.

# Problem statement

First, write a class MyArrayList that provides the following methods:

Your class should use a backing array: a (private!) instance field like private Object[] arr;. You will need to resize the array if someone tries to add an object and the array is currently full.

The code in MyArrayListTest demonstrates how your class is to be used.

# Next steps

Write an interface MyList that declares the size, add, insert, get, remove, and set methods. Change MyArrayListTest so that the test* functions take in any MyList object and test it.

Then, write a different list implementation. For example, a linked list stores a list of nodes, where each node is maybe something like:

// Contained in MyLinkedList
private static class LinkedListNode {
	// Note: fields have package-private visibility
	Object o; // The value
	LinkedListNode next; // null if this was the last node

How do you expect this to compare with MyArrayList in terms of performance for the various methods?