2015-11-02 SuperArray

posted Nov 2, 2015, 6:06 AM by Samuel Konstantinovich   [ updated Nov 2, 2015, 6:06 AM ]
//You should have these:
1. boolean add(int element)
    Appends the specified element to the end of this list. It returns true (add this part)

2. int     get(int index)
    Returns the element at the specified position in this list.

3. int    size()
    Returns the number of elements in this list.

4. String toString()

5. String toStringDebug()

//What do you think about these?

//Easy ones:
6. void clear()
    Removes all of the elements from this list.

7. boolean isEmpty()
    Returns true if this list contains no elements.

8. int    set(int index, int element)
    Replaces the element at the specified position in this list with the specified element. Returns the value of the element replaced. 

//harder ones:
9. void add(int index, int element)
    Inserts the specified element at the specified position in this list.

10. int remove(int index)
    Removes the element at the specified position in this list. Returns the value of the element removed.

11. int[] toArray()
    Returns an array containing all of the elements in this list in proper sequence (from first to last element).

//Later:
12. int indexOf(Object o)
Returns the index of the first occurrence of the specified element in this list, or -1 if this list does not contain the element.

13. int lastIndexOf(Object o)
Returns the index of the last occurrence of the specified element in this list, or -1 if this list does not contain the element.







Comments