Create a Table class with three methods:
NOTE: for this exercise you only need to handle storing Strings in the Table; Modifying your finished Table class to handle columns with different data types is a good stretch assignment.
insert()
- Takes 1 parameter: a record (
String->String
key-value pairs; keys represent column names in the table and values are String values stored in each column) - Stores the records in a data structure in the Table class
- Returns the unique ID number of the newly inserted database row (IDs start at 1)
findById()
- Takes 1 parameter: an ID number
- Returns the record corresponding to that id number
- Example:
findById(4)
findBy()
- Takes 2 parameters: column name and a value
- Returns a list of all record IDs that contain that value.
- Example:
findBy("age", "42")