Pontificia Universidad Católica de Chile Pontificia Universidad Católica de Chile
Nostas J., Sandoval Alcocer J.P., Costa D.E., Bergel A. (2021) How Do Developers Use the Java Stream API?. In: Gervasi O. et al. (eds) Computational Science and Its Applications – ICCSA 2021. ICCSA 2021. Lecture Notes in Computer Science, vol 12955. Springer, Cham. https://doi.org/10.1007/978-3-030-87007-2_23 (2021)

How do developers use the Java Stream API?

Revista : Computational Science and Its Applications – ICCSA 2021
Volumen : 12955
Páginas : 12
Tipo de publicación : Conferencia No DCC Ir a publicación


Java 8 marked a shift in the Java development landscape by introducing functional-like concepts in its stream library. Java developers can now rely on stream pipelines to simplify data processing, reduce verbosity, easily enable parallel processing and increase the expressiveness of their code. While streams have seemingly positive effects in Java development, little is known to what extent Java developers have incorporated streams into their programs and the degree of adoption by the Java community of individual stream’s features.This paper presents a replication study on which we analyze the stream usage of 610 Java projects. Our findings show that the Java streams are used mostly by software libraries rather than regular applications. Developers rarely use parallel processing, and when they do so, they only superficially use parallelism features and most of the parallel streams are used on simple forEach operations. The most common used pipelines involve map, filter and collect operations. We carefully describe a number of stream idioms we identified, and detail how we addressed the challenges we faced to complete our study. Our findings will help developers at (i) making better decisions about which features to consider when improving the API and (ii) supporting stream-related IDEs features, such as refactoring.