What do two semicolons mean in Java for loop?

前端 未结 5 1259
渐次进展
渐次进展 2020-12-17 07:51

I was looking inside the AtomicInteger Class and I came across the following method:

/**
 * Atomically increments by one the current value.
 *
          


        
5条回答
  •  感动是毒
    2020-12-17 08:22

    It's the same thing as

    while(true) {
        //do something
    }
    

    ...just a little bit less clear.
    Notice that the loop will exit if compareAndSet(current, next) will evaluate as true.

提交回复
热议问题