Simplify ViewManagerOnDemandReactPackage.getViewManagerNames to return Collection

Summary:
This way we can avoid unnecessary ArrayList copies.

Changelog: [Android][Changed] Generalized the return type of ViewManagerOnDemandReactPackage.getViewManagerNames

Reviewed By: nlutsenko

Differential Revision: D36131516

fbshipit-source-id: 6a42c76cadbcce4c3720875d80062e1ee237bc2f
This commit is contained in:
Pieter De Baets authored and Facebook GitHub Bot committed 2022-05-13 06:50:04 -07:00
1 parent d7921f0504
commit 51e029ec3c
6 files changed
+18 -17

No files matched your search

@@ -12,6 +12,7 @@ import static com.facebook.systrace.Systrace.TRACE_TAG_REACT_JAVA_BRIDGE;
import androidx.annotation.Nullable;
import com.facebook.react.common.MapBuilder;
import com.facebook.systrace.SystraceMessage;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@@ -33,7 +34,7 @@ import java.util.Map;
*/
/* package */ static Map<String, Object> createConstants(ViewManagerResolver resolver) {
Map<String, Object> constants = UIManagerModuleConstants.getConstants();
constants.put("ViewManagerNames", resolver.getViewManagerNames());
constants.put("ViewManagerNames", new ArrayList<>(resolver.getViewManagerNames()));
constants.put("LazyViewManagersEnabled", true);
return constants;
}
@@ -7,7 +7,7 @@
package com.facebook.react.uimanager;
import java.util.List;
import java.util.Collection;
import javax.annotation.Nullable;
/** Enables lazy discovery of a specific {@link ViewManager} by its name. */
@@ -22,5 +22,5 @@ public interface ViewManagerResolver {
/**
* Provides a list of view manager names to register in JS as {@code UIManager.ViewManagerName}
*/
List<String> getViewManagerNames();
Collection<String> getViewManagerNames();
}