Question: I am asked to compile the following specification in Eclipse, it is not compiling and giving errors. I cannot answer the following questions that requires

I am asked to compile the following specification in Eclipse, it is not compiling and giving errors. I cannot answer the following questions that requires the following specification to compile, please help.

public static List tail (List list) { // REQUIRES: ??? // EFFECTS: ??? List result = new ArrayListlist); result.remove(0); return result; }

1. What does the implementation of tail do in each of the following cases?

(a) list = null

(b) list = []

(c) list = [1]

(d) list = [1, 2, 3]

2. Write a partial specification that matches the "happy path" part of the implementation's behavior.

3. Rewrite the specification to be total. Use Bloch's standard exceptions.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!