edu.wpi.first.wpilibj.smartdashboard

## Class SendableChooser<V>

- java.lang.Object
- - edu.wpi.first.wpilibj.smartdashboard.SendableChooser<V>

- Type Parameters:
    `V` - The type of the values to be stored
  All Implemented Interfaces:
    Sendable

      public class SendableChooser<V>
      extends java.lang.Object
      implements Sendable

  The `SendableChooser` class is a useful tool for presenting a selection of options to the `SmartDashboard`.

  For instance, you may wish to be able to select between multiple autonomous modes. You can do this by putting every possible `Command` you want to run as an autonomous into a `SendableChooser` and then put it into the `SmartDashboard` to have a list of options appear on the laptop. Once autonomous starts, simply ask the `SendableChooser` what the selected value is.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `SendableChooser()` Instantiates a `SendableChooser`.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addDefault(java.lang.String name, V object)` Add the given object to the list of options and marks it as the default.
    `void` | `addObject(java.lang.String name, V object)` Adds the given object to the list of options.
    `V` | `getSelected()` Returns the selected option.
    `java.lang.String` | `getSmartDashboardType()` The string representation of the named data type that will be used by the smart dashboard for this `Sendable`.
    `void` | `initTable(NetworkTable table)` Initializes a table for this `Sendable` object.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### SendableChooser

          public SendableChooser()

      Instantiates a `SendableChooser`.

  - ### Method Detail

    - #### addObject

          public void addObject(java.lang.String name,
                                V object)

      Adds the given object to the list of options. On the `SmartDashboard` on the desktop, the object will appear as the given name.
      Parameters:
        `name` - the name of the option
        `object` - the option

    - #### addDefault

          public void addDefault(java.lang.String name,
                                 V object)

      Add the given object to the list of options and marks it as the default. Functionally, this is very close to `addObject(String, Object)` except that it will use this as the default option if none other is explicitly selected.
      Parameters:
        `name` - the name of the option
        `object` - the option

    - #### getSelected

          public V getSelected()

      Returns the selected option. If there is none selected, it will return the default. If there is none selected and no default, then it will return `null`.
      Returns:
        the option selected

    - #### getSmartDashboardType

          public java.lang.String getSmartDashboardType()

      Description copied from interface: `Sendable`
      The string representation of the named data type that will be used by the smart dashboard for this `Sendable`.
      Specified by:
        `getSmartDashboardType` in interface `Sendable`
      Returns:
        The type of this `Sendable`.

    - #### initTable

          public void initTable(NetworkTable table)

      Description copied from interface: `Sendable`
      Initializes a table for this `Sendable` object.
      Specified by:
        `initTable` in interface `Sendable`
      Parameters:
        `table` - The table to put the values in.