Skip to main content

Improving energy-efficiency by recommending Java collections


Over the last years, increasing attention has been given to creating energy-efficient software systems. However, developers still lack the knowledge and the tools to support them in that task. In this work, we explore our vision that non-specialists can build software that consumes less energy by alternating diversely-designed pieces of software without increasing the development complexity. To support our vision, we propose an approach for energy-aware development that combines the construction of application-independent energy profiles of Java collections and static analysis to produce an estimate of in which ways and how intensively a system employs these collections. We implement this approach in a tool named CT+ that works with both desktop and mobile Java systems and is capable of analyzing 39 different collection implementations of lists, maps, and sets. We applied CT+ to seventeen software systems: two mobile-based, twelve desktop-based, and three that can run in both environments. Our evaluation infrastructure involved a high-end server, two notebooks, three smartphones, and a tablet. Overall, 2295 recommendations were applied, achieving up to 16.34% reduction in energy consumption, usually changing a single line of code per recommendation. Even for a real-world, mature system such as Tomcat, CT+ could achieve a 4.12% reduction in energy consumption. Our results indicate that some widely used collections, e.g., ArrayList, HashMap, and Hashtable, are not energy- efficient and sometimes should be avoided when energy consumption is a major concern.

This is a preview of subscription content, access via your institution.

Fig. 1
Fig. 2
Fig. 3


  1. ONU sustainable goals:

  2. EU guidelines:

  3. Gist website:

  4. StackOverflow website:

  5. Java Collections Framework webiste:

  6. Apache Commons Collections website:

  7. Eclipse Collections website:

  8. WALA website:

  9. Maven’s new policy:

  10. Summary about hyper-threading:

  11. Xalan project:

  12. DaCapo website:

  13. Available at:

  14. On our experiments, the threshold was 100 times slower


  • Aggarwal K, Zhang C, Campbell JC, Hindle A, Stroulia E (2014) The power of system call traces: predicting the software energy consumption impact of changes. In: Proceedings of 24th Annual International Conference on Computer Science and Software Engineering, CASCON 2014. IBM / ACM, pp 219–233

  • Andrae A (2017) Total consumer power consumption forecast. Nordic Digital Business Summit 10

  • Baldwin CY, Clark KB Design rules, volume 1: The power of modularity, vol 1, 1st edn. The MIT Press

  • Barrett E, Bolz-Tereick CF, Killick R, Mount S, Tratt L (October 2017a) Virtual machine warmup blows hot and cold. Proc ACM Program Lang 1 (OOPSLA):52:1–52:27.

    Article  Google Scholar 

  • Bennett J, Lanning S, Netflix N (2007b) The netflix prize. In: In KDD Cup and Workshop in conjunction with KDD

  • Blackburn SM, Garner R, Hoffmann C, Khang AM, McKinley KS, Bentzur R, Diwan A, Feinberg D, Frampton D, Guyer S Z, Hirzel M, Hosking A, Jump M, Lee H, Moss JEB, Phansalkar A, Stefanović D, VanDrunen T, von Dincklage D, Wiedermann B (2006) The dacapo benchmarks: Java benchmarking development and analysis. In: Proceedings of the 21st Annual ACM SIGPLAN Conference on Object-oriented Programming Systems, Languages, and Applications, OOPSLA ’06. ACM, New York, pp 169–190.

  • Chen Q, Grosso P, Van Der Veldt K, De Laat C, Hofman R, Bal H (2011) Profiling energy consumption of VMs for green cloud computing. In: Proceedings - IEEE 9th International Conference on Dependable, Autonomic and Secure Computing, DASC 2011, pp 768–775

  • Chowdhury SA, Hindle A (2016) Characterizing energy-aware software projects: Are they different? In: Proceedings of the 13th International Conference on Mining Software Repositories, MSR ’16. ACM, New York, pp 508–511.

  • Chowdhury SA, Hindle A, Kazman R, Shuto T, Matsui K, Kamei Y (2019a) Greenbundle: An empirical study on the energy impact of bundled processing. In: 2019 IEEE/ACM 41st International Conference on Software Engineering (ICSE), pp 1107–1118

  • Chowdhury S, Borle S, Romansky S, Hindle A (August 2019b) Greenscaler: Training software energy models with automatic test generation. Empir Softw Engg 24(4):1649–1692.

    Article  Google Scholar 

  • Cliff N (1993) Answering ordinal questions with ordinal data using ordinal statistics. Multivar Behav Res 31:331–350.

    Article  Google Scholar 

  • Costa D, Andrzejak A, Seboek J, Lo D (2017) Empirical study of usage and performance of java collections. In: Proceedings of the 8th ACM/SPEC on International Conference on Performance Engineering, ICPE ’17. ACM, New York, pp 389–400.

  • Cruz L, Abreu R (2017) Performance-based guidelines for energy efficient mobile applications. In: Proceedings of the 4th International Conference on Mobile Software Engineering and Systems, MOBILESoft ’17. IEEE Press, pp 46–57.

  • Duarte LM, da Silva Alves D, Toresan BR, Maia PH, Silva D (2019) A model-based framework for the analysis of software energy consumption. In: Proceedings of the XXXIII Brazilian Symposium on Software Engineering, SBES 2019. Association for Computing Machinery, New York, pp 67–72.

  • Georges A, Buytaert D, Eeckhout L (October 2007) Statistically rigorous java performance evaluation. SIGPLAN Not 42 (10):57–76.

    Article  Google Scholar 

  • Georgiou S, Spinellis D (2020) Energy-delay investigation of remote inter-process communication technologies. J Syst Softw 162:110506.,

    Article  Google Scholar 

  • Hähnel M, Döbel B, Völp M, Härtig H (January 2012) Measuring energy consumption for short code paths using rapl. SIGMETRICS Perform Eval Rev 40(3):13–17.

    Article  Google Scholar 

  • Hao S, Li D, Halfond WGJ, Govindan R (2013) Estimating mobile application energy consumption using program analysis. In: Proceedings of the 2013 International Conference on Software Engineering, ICSE ’13. IEEE Press, Piscataway, pp 92–101.

  • Hasan S, King Z, Hafiz M, Sayagh M, Adams B, Hindle A (2016) Energy profiles of java collections classes. In: Proceedings of the 38th International Conference on Software Engineering, New York, pp 225–236.

  • Lee J, Chon Y, Cha H (2015) Evaluating battery aging on mobile devices. In: 2015 52nd ACM/EDAC/IEEE Design Automation Conference (DAC), pp 1–6

  • Li D, Hao S, Gui J, Halfond WGJ (2014a) An empirical study of the energy consumption of android applications. In: 30th IEEE International Conference on Software Maintenance and Evolution, pp 121–130

  • Li D, Tran AH, Halfond WGJ (2014b) Making web applications more energy efficient for OLED smartphones. In: 36th International Conference on Software Engineering (ICSE’2014). ACM, pp 527–538

  • Lima L G, Soares-Neto F, Lieuthier P, Castor F, Melfe G, Fernandes JP (2016) Haskell in Green Land: Analyzing the Energy Behavior of a Purely Functional Language. In: 2016 IEEE 23rd International Conference on Software Analysis, Evolution, and Reengineering (SANER), vol 1, pp 517–528

  • Lin Y, Dig D (2015) A study and toolkit of CHECK-THEN-ACT idioms of java concurrent collections. Softw Test Verif Reliab 25(4):397–425

    Article  Google Scholar 

  • Linares-Vásquez M, Bavota G, Bernal-Cárdenas C, Oliveto R, Di Penta M, Poshyvanyk D (2014) Mining energy-greedy api usage patterns in android apps: An empirical study. In: Proceedings of the 11th Working Conference on Mining Software Repositories, MSR 2014. ACM, New York, pp 2–11.

  • Linares-Vásquez M, Bavota G, Cárdenas CEB, Oliveto R, Di Penta M, Poshyvanyk D (2015) Optimizing energy consumption of guis in android apps: A multi-objective approach. In: Proceedings of the 2015 10th Joint Meeting on Foundations of Software Engineering, ESEC/FSE 2015. ACM, New York, pp 143–154

  • Linares-Vásquez M, Bavota G, Bernal-Cárdenas C, Penta MD, Oliveto R, Poshyvanyk D (2018) Multi-objective optimization of energy consumption of guis in android apps. ACM Trans Softw Eng Methodol 27(3):14:1–14:47

    Article  Google Scholar 

  • Liu K, Pinto G, Liu D (2015) Data-oriented characterization of application-level energy optimization. In: Proceedings of the 18th International Conference on Fundamental Approaches to Software Engineering, FASE’15

  • Lyu Y, Gui J, Wan M, Halfond WGJ (2017) An Empirical Study of Local Database Usage in Android Applications. In: Proceedings of the International Conference on Software Maintenance and Evolution (ICSME)

  • Manotas I, Pollock L, Clause J (2014) Seeds: A software engineer’s energy-optimization decision support framework. In: Proceedings of the 36th International Conference on Software Engineering, ICSE 2014, pp 503–514.

  • Manotas I, Bird C, Zhang R, Shepherd D, Jaspan C, Sadowski C, Pollock L, Clause J (2016) An empirical study of practitioners’ perspectives on green software engineering. In: ICSE, pp 237–248

  • Mcintosh A, Hassan S, Hindle A (April 2019) What can android mobile app developers do about the energy consumption of machine learning?. Empir Softw Engg 24(2):562–601.

    Article  Google Scholar 

  • Mingay S (2007) Green IT: The new industry shockwave. Gartner RAS Core Research Note G00153703

  • Oliveira W, Oliveira R, Castor F (2017) A Study on the Energy Consumption of Android App Development Approaches. In: 2017 IEEE/ACM 14th International Conference on Mining Software Repositories (MSR)

  • Oliveira W, Oliveira R, Castor F, Fernandes B, Pinto G (2019) Recommending energy-efficient java collections. In: 2019 IEEE/ACM 16th International Conference on Mining Software Repositories (MSR), pp 160–170

  • Pang C, Hindle A, Adams B, Hassan A E (2016) What do programmers know about software energy consumption?. IEEE Softw 33(3):83–89.

    Article  Google Scholar 

  • Pereira R, Couto M, Saraiva J, Cunha J, Fernandes JP (2016) The Influence of the Java Collection Framework on Overall Energy Consumption. In: Proceedings of the 5th International Workshop on Green and Sustainable Software, GREENS ’16. ACM, New York, pp 15–21.

  • Pereira R, Couto M, Ribeiro F, Rua R, Cunha J, Fernandes JP, Saraiva J (2017) Energy Efficiency Across Programming Languages: How Do Energy, Time, and Memory Relate? In: Proceedings of the 10th ACM SIGPLAN International Conference on Software Language Engineering, SLE 2017. ACM, New York, pp 256–267.

  • Pereira R, Simão P, Cunha J, Saraiva J (2018) jStanley: Placing a Green Thumb on Java Collections. In: Proceedings of the 33rd ACM/IEEE International Conference on Automated Software Engineering, ASE 2018. ACM, New York, pp 856–859.

  • Peterson M (2009) Decisions under ignorance. In: An Introduction to Decision Theory, Cambridge Introductions to Philosophy. Cambridge University Press, pp 40–63

  • Pinto G, Castor F, Liu Y (2014a) Mining questions about software energy consumption. In: Proceedings of the 11th Working Conference on Mining Software Repositories, MSR 2014, pp 22–31

  • Pinto G, Castor F, Liu Y D (2014b) Understanding energy behaviors of thread management constructs. In: Proceedings of the 2014 ACM International Conference on Object Oriented Programming Systems Languages and Applications, OOPSLA ’14, pp 345–360

  • Pinto G, Liu K, Castor F, Liu YD (2016) A comprehensive study on the energy efficiency of java thread-safe collections. In: ICSME

  • Rocha G, Castor F, Pinto G (2019) Comprehending energy behaviors of java i/o apis. In: 2019 ACM/IEEE International Symposium on Empirical Software Engineering and Measurement (ESEM), pp 1–12

  • Rodrigues RE, Alves P, Pereira F, Gonnord L (2014) Real-world loops are easy to predict: a case study. In: Workshop on Software Termination (WST’14)

  • Romano J, Kromrey JD, Coraggio J, Skowronek J (2006) Appropriate statistics for ordinal level data: Should we really be using t-test and cohen’s d for evaluating group differences on the NSSE and other surveys? In: Annual meeting of the Florida Association of Institutional Research

  • Romansky S, Borle NC, Chowdhury S, Hindle A, Greiner R (2017) Deep green: Modelling time-series of software energy consumption. In: 2017 IEEE International Conference on Software Maintenance and Evolution (ICSME), pp 273–283

  • Saborido R, Morales R, Khomh F, Guéhéneuc Y-G, Antoniol G (2018) Getting the most from map data structures in Android. Empir Softw Eng.

  • Sahin C, Cayci F, Gutiérrez ILM, Clause J, Kiamilev F, Pollock L, Winbladh K (2012) Initial explorations on design pattern energy usage. In: 2012 1st International Workshop on Green and Sustainable Software, GREENS 2012 - Proceedings, pp 55–61

  • Sahin C, Pollock L, Clause J (2014) How do code refactorings affect energy usage? In: Proceedings of the 8th ACM/IEEE International Symposium on Empirical Software Engineering and Measurement, ESEM ’14, pp 36:1–36:10

  • Shapiro SS, Wilf MB (1965) An Analysis of Variance Test for Normality (complete samples). Biometrika 52(3-4):591–611

    MathSciNet  Article  Google Scholar 

  • Šimunić T, Benini L, De Micheli G, Hans M (2000) Source code optimization and profiling of energy consumption in embedded systems. In: Proceedings of the International Symposium on System Synthesis, pp 193–198

  • Wan M, Jin Y, Li D, Gui J, Mahajan S, Halfond William GJ (2017) Detecting display energy hotspots in android apps. Softw Test Verif Reliab 27(6):16–35

    Article  Google Scholar 

  • Wilks D S (2011) Statistical methods in the atmospheric sciences. Elsevier Academic Press, Amsterdam.

Download references


We would like to thank the anonymous reviewers for helping to improve this paper. This paper acknowledges the support of the Erasmus+ Key Action 2 (Strategic partnership for higher education) project No. 2020-1-PT01-KA203-078646: ”SusTrainable - Promoting Sustainability as a Fundamental Driver in Software Development Training and Education”. The information and views set out in this paper are those of the author(s) and do not necessarily reflect the official opinion of the European Union. Neither the European Union institutions and bodies nor any person acting on their behalf may be held responsible for the use which may be made of the information contained therein. This research was partially funded by CAPES/Brazil (88887.364121/2019-00), CNPq/Brazil (304755/2014-1, 406308/2016-0, 465614/2014-0, 309032/2019-9), FACEPE/Brazil (APQ-0839-1.03/14, 0388-1.03/14, 0592-1.03/15).

Author information

Authors and Affiliations


Corresponding author

Correspondence to Wellington Oliveira.

Additional information

Communicated by: Ali Ouni, David Lo, Xin Xia, Alexander Serebrenik and Christoph Treude

Publisher’s note

Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

This article belongs to the Topical Collection: Recommendation Systems for Software Engineering

Rights and permissions

Reprints and Permissions

About this article

Verify currency and authenticity via CrossMark

Cite this article

Oliveira, W., Oliveira, R., Castor, F. et al. Improving energy-efficiency by recommending Java collections. Empir Software Eng 26, 55 (2021).

Download citation

  • Accepted:

  • Published:

  • DOI:


  • Energy consumption
  • Collections
  • Recommendation systems