nfsantos commented on code in PR #2065:
URL: https://github.com/apache/jackrabbit-oak/pull/2065#discussion_r1948584601


##########
oak-core-spi/src/main/java/org/apache/jackrabbit/oak/spi/mount/SimpleMountInfoProvider.java:
##########
@@ -67,9 +70,9 @@ public boolean hasNonDefaultMounts() {
     }
 
     @Override
-    public Collection<Mount> getMountsPlacedUnder(String path) {
-        Collection<Mount> mounts = new ArrayList<>();
-        for ( Mount mount : this.mounts.values()) {
+    public @NotNull Collection<Mount> getMountsPlacedUnder(String path) {
+        Collection<Mount> mounts = new ArrayList<>(this.mounts.size());

Review Comment:
   I see, in the common case, only one mount will pass the test. I also 
considered creating the array lazily, only when one match is found, but I don't 
think this method is called frequently enough to be worth the extra complexity. 
So I changed it to create an array of fixed size 1, as suggested.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to