Groovy web console

subscribe to the feed Subscribe
to this
site

supplier

Published 2 months ago by ac
Actions Execute script  ▶ Edit in console Back to console Show/hide line numbers View recent scripts
import java.util.concurrent.atomic.AtomicInteger
import java.util.function.Supplier

AtomicInteger atomicInt = new AtomicInteger(1)
Supplier supp = { atomicInt.getAndIncrement() } as Supplier

50.times {
    println supp.get()
}