Interface StaticSequence<Item>

Type Parameters:
Item - the item type
All Superinterfaces:
Container<Item>

public interface StaticSequence<Item> extends Container<Item>
A static sequence.

A container whose n items are in an order given by their indices, where the first item is at index 0, the second at index 1, and so on, the nth being at index n-1.

  • Method Summary

    Modifier and Type
    Method
    Description
    get(int index)
    Get the item at the given index.
    void
    set(int index, Item item)
    Set the item at the given index.

    Methods inherited from interface dsa.lab01.base.Container

    contains, isEmpty, size
  • Method Details

    • get

      Item get(int index) throws IndexOutOfBoundsException
      Get the item at the given index.
      Parameters:
      index - the index
      Returns:
      the item that is at that index
      Throws:
      IndexOutOfBoundsException - if index < 0 or index >= n (where n is the size)
    • set

      void set(int index, Item item) throws IndexOutOfBoundsException
      Set the item at the given index.

      Replaces whatever item was there before.

      Parameters:
      index - the index
      item - the new item that should now be at that index
      Throws:
      IndexOutOfBoundsException - if index < 0 or index >= n (where n is the size)