I have this following loop and I want to run it for just one time.
how can I do that?
for (AnnotationData annotations : annotation)
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
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.
Just break out!
Other answers are using counters or flags!? It never ceases to amaze me just how much code some people write to do the simplest of things. Typically, the more inferior the programmer, the more code they write.
Edited:
There is a misunderstanding by some commenters that a non-loop version would use “less code” or “less lines”. Such claims are untrue… here is the precise non-loop equivalent code:
This uses the same number of lines, but requires 23 more characters of code, although I grant you its intention is more emphatic.