ArrayList.trimToSize()

ArrayList

ArrayList.trimToSize() to minimize storage space of an ArrayList.

Examples with output

add()
ArrayList<Integer> marks = new ArrayList<Integer>(50);
marks.add(54);
marks.add(55);
marks.add(56);
marks.add(57);
marks.add(58);
marks.add(59);

marks.trimToSize(); 
System.out.println(marks);//[54, 55, 56, 57, 58, 59]
ArrayList Tutorials


Subscribe

* indicates required
Subscribe to plus2net

    plus2net.com



    Post your comments , suggestion , error , requirements etc here




    We use cookies to improve your browsing experience. . Learn more
    HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
    ©2000-2024 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer