• Post Reply Bookmark Topic Watch Topic
  • New Topic

Java Collection Vector size query .  RSS feed

 
Ravi Kiran Va
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I could not able to understand the below code in my application .

we are extracting contents of a Vector in my case , this logic is there in my application






Could anybody please tell me when this will get called actually ??

Thanks in advance .
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16060
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There's not really anything strange with that code, what do you find confusing about it?

The loop goes from i = 0 upto and including i = batchDetails.size() - 1 (because the condition in the for is i < batchDetails.size()).

The expression in the if statement will be true only in the last iteration of the loop.
 
Ravi Kiran Va
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you very much .
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To answer the actual question, that condition will *always* be called. Are you asking when it will be true? Do the math.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!