Performance evaluation of list iteration methods in Java: an empirical study

Abstract

Introduction: Lists are used in various software applications including web applications, desktop applications, and Internet of Things (IoT) applications to store different types of items (e.g. country name, product model, and device category). Users can select one or more of these items to perform specific tasks such as filling forms, ordering products, reading device data, etc. In some software applications, lists store a huge number of items to be iterated over in order to know what users have selected. From a software development perspective, there are a number of methods to iterate over list items. Materials and Methods: In this paper, five list iteration methods: Classic For, Enhanced For, Iterator, List Iterator, and For Each have been compared experimentally with each other with regard to their performance (execution time required to iterate over list items). Thus, a number of experimental test scenarios have been conducted to obtain the comparison results. Results and Discussion: The experimental results of this study have been presented in Table 4. Conclusions: Overall performance evaluation showed that Iterator and List Iterator methods outperformed other list iteration methods in all test scenarios. However, List Iterator outperformed Iterator when the list size was small. On the other hand, Iterator outperformed List Iterator when the list size was large.

Publication
INNOVACIENCIA,Vol. 6, No. 1