Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thospfuller/cff47778855e9b91c5f995cccf5c896f to your computer and use it in GitHub Desktop.
Save thospfuller/cff47778855e9b91c5f995cccf5c896f to your computer and use it in GitHub Desktop.
Turn an array into an ArrayList in Java using Guava
@Grapes(
@Grab(group='com.google.guava', module='guava', version='32.1.3-jre')
)
import static com.google.common.collect.Lists.newArrayList
def numbers = [1, 2, 3, 4, 5] as int[]
def result = newArrayList (numbers)
println "numbers.class: ${numbers.class.name}, result.class: ${result.class.name}, result: $result"
return;
@thospfuller
Copy link
Author

thospfuller commented Oct 18, 2023

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment