Skip to content

Instantly share code, notes, and snippets.

@rodrigoSaladoAnaya
Created November 20, 2014 16:49
Show Gist options
  • Save rodrigoSaladoAnaya/4096289797ca4b9a9501 to your computer and use it in GitHub Desktop.
Save rodrigoSaladoAnaya/4096289797ca4b9a9501 to your computer and use it in GitHub Desktop.
/**
* vertx version:
* 2.1.2 (built 2014-07-24 07:45:28)
* test:
* vertx run shared_set_error.groovy
**/
import org.vertx.java.core.shareddata.impl.SharedSet
SharedSet<String> sharedSet = vertx.sharedData.getSet(
'gertx.verticles'
)
['uno', 'dos', 'tres', 'cuatro'].each { n ->
sharedSet << n
}
println "1) sharedSet.size(): ${sharedSet.size()}"
println " -> ${sharedSet}"
for(int i = 0; i < sharedSet.size(); i++) {
def current = sharedSet[i]
println " *** (${i}) ${current}"
sharedSet.remove(current)
}
println "2) sharedSet.size(): ${sharedSet.size()}"
println " -> ${sharedSet}"
/** Output **
1) sharedSet.size(): 4
-> [cuatro, tres, uno, dos]
*** (0) cuatro
*** (1) uno
2) sharedSet.size(): 2
-> [tres, dos]
** **/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment