java - Convert FastSet to Array of String -
i have set: set<string> tmpset = fastset.newinstance();
when follow question: how convert set string[]?
and same: string[] strarrstrings = includefeatureids.toarray(new string[0]);
and have exception:
exception: java.lang.illegalargumentexception message: error running script @ location [component://order/webapp/ordermgr/web-inf/actions/entry/catalog/keywordsearch.groovy]: java.lang.unsupportedoperationexception: destination array small ---- cause --------------------------------------------------------------------- exception: java.lang.unsupportedoperationexception message: destination array small ---- stack trace --------------------------------------------------------------- java.lang.unsupportedoperationexception: destination array small javolution.util.fastcollection.toarray(fastcollection.java:351)
so now, have code as:
for (fastset.record r = tmpset.head(), end = tmpset.tail(); (r = r.getnext()) != end;) { // copy 1 one element string[] }
my question: there anyway(or utility) convert fastset string[]?
thank :-)
see also:
see fastcollection#toarray(t[])
unlike standard collection, method not try resize array
so have make array right size. use
includefeatureids.toarray(new string[includefeatureids.size()])
instead of
includefeatureids.toarray(new string[0])
Comments
Post a Comment