Martino, good question. Honestly I’m not sure, but I can’t imagine that any performance difference would be substantial between the two. Additionally, both operations (square bracket or .get() method) would be among the fastest operations in your code to begin with.

I did a short Google search and did not come up with anything specifically for this. Something to test in the future perhaps!

Written by

Top writer with 1M+ views. Follow me at medium.com/code-85 and medium.com/growth-85

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store