Consider a sorted list. Write an invariant in OCL denoting that the elements of the list are sorted.

What will be an ideal response?


The key to this exercise is to realize that the List class in Java provides an indexOf(element) method.
```
context SortedList inv:
elements->forAll(e1, e2:Object|
e1.lessThan(e2) implies indexOf(e1) < indexOf(e2))
```

Computer Science & Information Technology

You might also like to view...

__________ enables the smooth recovery of the file system following a system crash or disk failure.

a. FAT-32 b. FAT c. NTFS d. all of the above

Computer Science & Information Technology

If you switch to ____ mode, Photoshop will display a warning.

a. RGB b. CMYK c. Indexed d. Grayscale

Computer Science & Information Technology

Facebook allows companies to have a corporate presence on Facebook without overwhelming users with advertising

Indicate whether the statement is true or false

Computer Science & Information Technology

Case-Based Critical Thinking QuestionsCase 5-2Michelle's manager is very particular about the way in which she likes to have information reported to her. Because she is under pressure to produce the appropriate reports quickly, Michelle asks her coworker Riley to shorthand for her which reports to use to satisfy the requests.Michelle is looking for the Completed Tasks report, but she is not certain which category has it. Where does Riley refer her?

A. Costs B. Current C. Overview D. Workload

Computer Science & Information Technology