diff --git a/wpilibj/src/athena/java/edu/wpi/first/wpilibj/Preferences.java b/wpilibj/src/athena/java/edu/wpi/first/wpilibj/Preferences.java index 3c1cf49970..3ae9b47cd1 100644 --- a/wpilibj/src/athena/java/edu/wpi/first/wpilibj/Preferences.java +++ b/wpilibj/src/athena/java/edu/wpi/first/wpilibj/Preferences.java @@ -14,7 +14,6 @@ import edu.wpi.first.wpilibj.hal.HAL; import edu.wpi.first.wpilibj.networktables.NetworkTable; import edu.wpi.first.wpilibj.tables.ITable; import edu.wpi.first.wpilibj.tables.ITableListener; -import edu.wpi.first.wpilibj.tables.TableKeyNotDefinedException; /** * The preferences class provides a relatively simple way to save important values to the roboRIO to @@ -84,12 +83,8 @@ public class Preferences { * Gets the vector of keys. * @return a vector of the keys */ - public Vector getKeys() { - Vector keys = new Vector(); - for (String key : m_table.getKeys()) { - keys.add(key); - } - return keys; + public Vector getKeys() { + return new Vector<>(m_table.getKeys()); } /** @@ -202,11 +197,7 @@ public class Preferences { * @return either the value in the table, or the backup */ public int getInt(String key, int backup) { - try { - return (int) m_table.getNumber(key); - } catch (TableKeyNotDefinedException ex) { - return backup; - } + return (int) m_table.getNumber(key, backup); } /** @@ -218,7 +209,7 @@ public class Preferences { * @return either the value in the table, or the backup */ public double getDouble(String key, double backup) { - return m_table.getDouble(key, backup); + return m_table.getNumber(key, backup); } /** @@ -242,11 +233,7 @@ public class Preferences { * @return either the value in the table, or the backup */ public float getFloat(String key, float backup) { - try { - return (float) m_table.getNumber(key); - } catch (TableKeyNotDefinedException ex) { - return backup; - } + return (float) m_table.getNumber(key, backup); } /** @@ -258,11 +245,7 @@ public class Preferences { * @return either the value in the table, or the backup */ public long getLong(String key, long backup) { - try { - return (long) m_table.getNumber(key); - } catch (TableKeyNotDefinedException ex) { - return backup; - } + return (long) m_table.getNumber(key, backup); } /**