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

android - net_scheduler holding wakelock -

sql - MySQL : Getting Entries from a many-to-many table -

java - Retrieving data from database using jsp (Hibernate + Spring + Maven) -