Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1039459
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T15:06:08+00:00 2026-05-16T15:06:08+00:00

In the JDK 1.7 into the ArrayList.java the method ensureCapacity increments the array capacity

  • 0

In the JDK 1.7 into the ArrayList.java the method ensureCapacity increments the array capacity using the following expression: int newCapacity = oldCapacity + (oldCapacity >> 1) so it seems that the new capacity will be almost the 50% more than the old.

However in many books is said that the capacity is doubled… so the books aren’t updated or I don’t understand well?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T15:06:09+00:00Added an answer on May 16, 2026 at 3:06 pm

    You’re understanding is correct, newCapacity is 50% more than oldCapacity

    In Java 6 newCapacity is calculated as

    int newCapacity = (oldCapacity * 3)/2 + 1;
    

    This is the beauty of an open source language such as Java, you can see the implementation – if it doesn’t fit your requirements, you can implement your own.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Will Java code built and compiled against a 32-bit JDK into 32-bit byte code
I am using jdk 1.6 My main method : exmp3<String , Integer> exmp3 =
My java project build in jdk 7 . I want to convert it into
Use JDK , I can compile a .java file into a .class file, then
Currently I'm using Java jdk 1.6.0_26 for my eclipse based application. As now Java
I am working on Java EE project with following configuration: UI: Flex JDK: 1.5
I am using Eclipse Indigo (3.7.0), with JDK 1.6.0_22, and I am running into
I just ran into a problem with the version of JAX-WS in JDK 1.6.0
The JDK documentation for java.lang.String.hashCode() famously says: The hash code for a String object
I had java jdk 1.6 installed, and today installed jdk 1.7 becaused needed to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.