[commands] Make Java SelectCommand generic (#5849)

This allows users to use any type of map and selector without needing to explicitly match
Map<Object, Command>
This commit is contained in:
Ryan Blue
2023-10-30 14:09:14 -04:00
committed by GitHub
parent 9eecf2a456
commit a4a8ad9c75
5 changed files with 23 additions and 19 deletions

View File

@@ -36,7 +36,7 @@ public class RobotContainer {
// selector does not have to be an enum; it could be any desired type (string, integer,
// boolean, double...)
private final Command m_exampleSelectCommand =
new SelectCommand(
new SelectCommand<>(
// Maps selector values to commands
Map.ofEntries(
Map.entry(CommandSelector.ONE, new PrintCommand("Command one was selected!")),