GoodStuff Docs
Fall 2026
API

# Category

o1.goodstuff.Category
class Category(val `name`: String, val `unit`: String)

The class `Category` represents categories of experiences in the GoodStuff diary application. A single category contains zero or more experiences that are similar in some way and are purchased in units of the same kind. A category object could be used represent hotel experiences, for instance, or wines the diarist has tasted.

A category object has a mutable state: A newly created category has no experiences yet; experiences must be added to it using the `addExperience` method.

## Parameters

name

  the name of the category, such as "Hotel" or "Wine"

unit

  the name of the pricing unit associated with the experiences in this category, such as "night" or "bottle"

## Attributes

Graph
Supertypes
  class Object
  trait Matchable
  class Any

## Members list

### Value members

#### Concrete methods

def addExperience(`newExperience`: Experience): Unit

Adds a new experience to this category.

Adds a new experience to this category.

## Attributes

def allExperiences: Vector[Experience]

Returns a collection containing all the experiences recorded in this category.

Returns a collection containing all the experiences recorded in this category.

## Attributes

def favorite: Option[Experience]

Returns the experience that the user has rated the highest in this category. That is, of all the experiences added into this category so far, returns the one with the highest rating. If there is a tie for first place, the experience recorded first is returned.

Returns the experience that the user has rated the highest in this category. That is, of all the experiences added into this category so far, returns the one with the highest rating. If there is a tie for first place, the experience recorded first is returned.

## Attributes

#### Concrete fields

val name: String
val unit: String