Click here to Skip to main content
16,017,207 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello, everyone, I know this question of mine is very noob for you guys but I can't just sleep not knowing the meaning of this symbol in java :

Im searching how to convert a string arraylist to an integer arraylist and I saw this:

Java
for (String myInt : strArrayList)
           {
             newList.add(Integer.valueOf(myInt));
           }


I don't understand what is this : in the for clause.

What I have tried:

I search through this

https://docs.oracle.com/javase/tutorial/java/nutsandbolts/opsummary.html

and saw the ternary operator but it's like this ?:
and not this : it's really bugging me.
Posted
Updated 14-Aug-20 22:18pm
v2

It's the format of a for-each[^] loop in Java. It reads as "for each string myInt in strArrayList".
 
Share this answer
 
Comments
lelouch_vi 2 15-Aug-20 0:19am    
nice thanks!, I didn't know that java has a for each loop.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900