18.11.2014 Views

public class RecentlyUsedList - Jfokus

public class RecentlyUsedList - Jfokus

public class RecentlyUsedList - Jfokus

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

given:<br />

expectedSize = size() + (contains(newItem) ? 0 : 1)<br />

precondition:<br />

newItem != null<br />

postcondition:<br />

get(0).equals(newItem) && size() == expectedSize<br />

<strong>public</strong> <strong>class</strong> <strong>RecentlyUsedList</strong><br />

{<br />

<strong>public</strong> void add(String newItem) ...<br />

<strong>public</strong> String get(int index) ...<br />

...<br />

}<br />

What would a <strong>class</strong> inheriting from<br />

<strong>RecentlyUsedList</strong> be permitted and<br />

disallowed from doing?<br />

precondition:<br />

index >= 0 && index < size()<br />

postcondition:<br />

returns != null

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!