Groovy web console

subscribe to the feed Subscribe
to this
site
Compare items (via #groovywebconsole)
tweet this snippet Tweet
this
script

Compare items

Published 3 months ago by @jagedn with tags list drop compare
Actions  ➤ Edit in console Back to console Show/hide line numbers View recent scripts
def list = [1,1,2,2,3,3,4,5,6,7]
def compare = list.drop(1)
list.dropRight(1).eachWithIndex{ item, idx ->
   if( item == compare[idx] )
      println "$item ${compare[idx]}"
}
true