Use Array Constructor rather then new array to toArray (#1368)

A bit cleaner to use, and more standard for the current java. Still java 8 compatible.
This commit is contained in:
Thad House
2018-10-16 01:30:42 -07:00
committed by Peter Johnson
parent c7118f8ade
commit 11e5faf469
3 changed files with 3 additions and 3 deletions

View File

@@ -129,7 +129,7 @@ public final class CameraServer {
}
}
return values.toArray(new String[0]);
return values.toArray(String[]::new);
}
@SuppressWarnings({"JavadocMethod", "PMD.AvoidUsingHardCodedIP"})

View File

@@ -152,7 +152,7 @@ public class SendableChooser<V> extends SendableBase {
return m_defaultChoice;
}, null);
builder.addStringArrayProperty(OPTIONS, () -> {
return m_map.keySet().toArray(new String[0]);
return m_map.keySet().toArray(String[]::new);
}, null);
builder.addStringProperty(ACTIVE, () -> {
m_mutex.lock();