Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


if arraylist size is increased from initial size what is
the size of arraylist...suppose initial is 100 , if i add
101 element what is the size...

Answers were Sorted based on User's Feedback



if arraylist size is increased from initial size what is the size of arraylist...suppose initial i..

Answer / ravindra reddy

The size of the arraylist will increase to 150 why because
in arraylist the elements are reach to initial size of the
array list then size will be increase to half of the
capacity

Is This Answer Correct ?    38 Yes 13 No

if arraylist size is increased from initial size what is the size of arraylist...suppose initial i..

Answer / reddy

(initial capacity*3/2)+1
(100*3/2)+1

Is This Answer Correct ?    28 Yes 4 No

if arraylist size is increased from initial size what is the size of arraylist...suppose initial i..

Answer / siri

remember.. there are 2 things involved.. capacity and size..
capacity represents how many max elements the list can
accomodate in it, size represents how many elements are
present currently in the list..the capacity is automatically
increased by certain amount (10, 20, 30..) based on the
current size once the size is equal to capacity..

Is This Answer Correct ?    9 Yes 2 No

if arraylist size is increased from initial size what is the size of arraylist...suppose initial i..

Answer / srinu

Arraylist are growble nature.so present capacity of arraylist
100 then add an 101 element then that time current capacity
is formula
(101*3/2)+1=151

Is This Answer Correct ?    10 Yes 6 No

if arraylist size is increased from initial size what is the size of arraylist...suppose initial i..

Answer / rajnish

The Size of the arraylist will become 101 only once you call suppose al.size() but it will calculate it's capacity like below:

New Capacity = (current capacity*3/2)+1

Is This Answer Correct ?    5 Yes 1 No

if arraylist size is increased from initial size what is the size of arraylist...suppose initial i..

Answer / saty

It is undocumented by sun/oracle. Also it varies from one
java cersion to another..... in Java 6==>
(100*3)/2+1

Is This Answer Correct ?    0 Yes 3 No

if arraylist size is increased from initial size what is the size of arraylist...suppose initial i..

Answer / satish

from the Java Source code of ensureCapacity() API,

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

So, (100 *3)/2 + 1 will be the answer.

Is This Answer Correct ?    1 Yes 4 No

if arraylist size is increased from initial size what is the size of arraylist...suppose initial i..

Answer / dhruba guha

if the initial size is = N

then it will expanded memory will be = N + N/2 +1

Is This Answer Correct ?    1 Yes 5 No

if arraylist size is increased from initial size what is the size of arraylist...suppose initial i..

Answer / anjani

when we create the arraylist, we have two factors
1- inital size of array list,
2 - load factor (default is .75).

load factor means size of the arraylist will be doubled if
we fill 75% of the size availabe.

i mean if intial size of arraylist is 100 then when we will
insert 75th element in the arraylist, its size will be doubled.

Is This Answer Correct ?    13 Yes 19 No

if arraylist size is increased from initial size what is the size of arraylist...suppose initial i..

Answer / sri

same 100 since the count starts from 0 onwards its obcious
tat u wud have 101 elements

Is This Answer Correct ?    7 Yes 35 No

Post New Answer

More Core Java Interview Questions

class A { public void disp(int a,int b) { System.out.println("hai"); } } class B { public void disp(int a,int b,int c) { System.out.println("hai"); } } above program is overloading or overriding?

9 Answers   Infosys, Wipro,


What is the difference between jsp and servlet?

6 Answers   Symphony,


What will happen when using pass by reference in java?

0 Answers   HCL,


Explain reverse a linked list iterative solution in java?

0 Answers  


wht is mean by dirty read?

1 Answers  


What is the meaning of variables in research?

0 Answers  


Package1 and Package2 both have a method name lets say "methodA" with different implementation. When I import both the packages in a java class how can I use both the methods?

7 Answers   Ericsson,


Differentiate between array list and vector in java.

0 Answers  


What is string array?

0 Answers  


what is the difference between System.exit() and System.exit(1)?

1 Answers   eClinical Solutions, eClinical Works, eClinicalWorks,


How can we break singleton in java?

0 Answers  


what is the diff between Servletcontext and servletconfig?

5 Answers  


Categories