diff --git a/wpiutil/src/main/java/edu/wpi/first/util/datalog/DataLog.java b/wpiutil/src/main/java/edu/wpi/first/util/datalog/DataLog.java index eef23385219..025487cd299 100644 --- a/wpiutil/src/main/java/edu/wpi/first/util/datalog/DataLog.java +++ b/wpiutil/src/main/java/edu/wpi/first/util/datalog/DataLog.java @@ -118,7 +118,7 @@ public void resume() { * @return True if schema already registered */ public boolean hasSchema(String name) { - return m_schemaSet.contains(name); + return m_schemaMap.containsKey(name); } /** @@ -134,7 +134,7 @@ public boolean hasSchema(String name) { * @param timestamp Time stamp (may be 0 to indicate now) */ public void addSchema(String name, String type, byte[] schema, long timestamp) { - if (!m_schemaSet.add(name)) { + if (m_schemaMap.putIfAbsent(name, 1) != null) { return; } DataLogJNI.addSchema(m_impl, name, type, schema, timestamp); @@ -168,7 +168,7 @@ public void addSchema(String name, String type, byte[] schema) { * @param timestamp Time stamp (may be 0 to indicate now) */ public void addSchema(String name, String type, String schema, long timestamp) { - if (!m_schemaSet.add(name)) { + if (m_schemaMap.putIfAbsent(name, 1) != null) { return; } DataLogJNI.addSchemaString(m_impl, name, type, schema, timestamp); @@ -506,5 +506,4 @@ private void addSchemaImpl(Struct struct, long timestamp, Set seen) { private long m_impl; private final ConcurrentMap m_schemaMap = new ConcurrentHashMap<>(); - private final Set m_schemaSet = m_schemaMap.keySet(); }