How to trim the size of the ArrayList

Tutorials Shared by the Internet Community

Advertisements


Synopsis

Java: How to trim the unused space allocated to the ArrayList

Statistics

  • Total Hits - 21565

  • Total Votes - 177 votes

  • Vote Up - 58 votes

  • Vote Down - 119 votes

  • Domain - beginnersbook.com

  • Category - JAVA/Collections

  • Submitted By - Chaitanya

  • Submitted on - 2014-01-09 07:53:09

Description

In this tutorial we will learn how to trim the unused space allocated to the ArrayList. For e.g. If allocated space to the ArrayList can hold 200 elements but it has only 100 elements then using the trim() method would free up the memory of 100 elements ...


Site  |   Broken  |   Tweet  |   Facebook  |     |   Save  |   Liked  |   Down

Advertisements