Last active
April 15, 2024 08:01
-
-
Save thospfuller/cff47778855e9b91c5f995cccf5c896f to your computer and use it in GitHub Desktop.
Turn an array into an ArrayList in Java using Guava
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
See the following articles: How To Convert An Array To An ArrayList In Java! and Tutorial: Learn how to convert an array to an ArrayList in Java Using Google Guava!.