Return to lecture notes index

15-100 Lecture 29 (Monday, November 14, 2005)

Quick Quiz

Given the OrderedContainer from last class, please implement the getLessThan(...) method. This isn't a trick question, it should work just as it did last time, returning a new OrderedCollection, without damaging the original:


public OrderedCollection getLessThan (Comparable key) {
  OrderedContainer newContainer = new OrderedContainer();

  for (int index=0; index < nextSlot; index++)
    if (list[index].compareTo(item) <= 0) 
      break;

    newContainer.add(key);

  return newContainer;
}

Answering Questions

We answered various questions and discussed administrative issues for a few minutes -- and a few minutes more than expected.

Sets

We began discussing Sets, but didn't get as far as expected. For consiseness, these notes will be included with the rest of the discussion next time.

Next Class

...we'll dig into Sets.