Convert Iterable to Array using Guava

guava, java

Solution

Use the `Iterables.toArray(Iterable<? extends T> iterable, Class<T> type)` method in Guava.

Problem

I need to return a `String` array. I use Guava to split the `String`. Please see the code below ``` Iterable<String> arrayOfValues = Splitter.on(";").split(myString); ``` it returns an `Iterable`. but i need a `String[]`. Is there are any way to give `Iterator< Element >` and convert that to `Array[]`. Many Thanks

Original source

Related problems