casting - Convert Queue<Deque<String>> into Object[][] in Java -


i'm building dynamic test @dataprovider annotation testng. in java, how convert data structure defined queue<deque<string>> queueofdeques = arraydeque<deque<string>>(); object[][]? based on this explanation, tried this:

@dataprovider( name = "providedqueue" ) public static object[][] datafortest(){         return new object[][]{{someclass.getqueueofdeques}};     } 

where method getqueueofdeques returns queueofdeques data structure defined above. don't know i'm doing wrong, not converting variable should be, deriving testng ignores parameterized test.

java.lang.classcastexception: net.easysol.detectid.migrationtester.arraydeque cannot cast java.lang.string

simply iteration:

static object[][] convert(collection<? extends collection<?>> cc) {     object[][] res = new object[cc.size()][];      int = 0;     (collection<?> c : cc)         res[i++] = c.toarray();     return res; } 

such general method converting collection of collections (they may queue, deque, list , many others) of type (as <?> refers) object[][] array.


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -