I have a set:
Set<String> tmpSet = FastSet.newInstance();
When i follow this question: How to convert Set to String[]?
and i do the same:
String[] strArrStrings = includeFeatureIds.toArray(new String[0]);
and i have this exception:
Exception: java.lang.IllegalArgumentException
Message: Error running script at location [component://order/webapp/ordermgr/WEB-INF/actions/entry/catalog/KeywordSearch.groovy]: java.lang.UnsupportedOperationException: Destination array too small
---- cause ---------------------------------------------------------------------
Exception: java.lang.UnsupportedOperationException
Message: Destination array too small
---- stack trace ---------------------------------------------------------------
java.lang.UnsupportedOperationException: Destination array too small
javolution.util.FastCollection.toArray(FastCollection.java:351)
So now, i have to code as:
for (FastSet.Record r = tmpSet.head(), end = tmpSet.tail(); (r = r.getNext()) != end;) {
// copy one by one element to String[]
}
My question: Is there anyway(or utility) to convert FastSet to String[]?
Thank :-)
See also: