java - Convert JavaUtilList to NSArray? -


using j2objc have javautillist:

var javaarraylist:javautillist = javaarraylist() 

i want convert list nsarray:

var arr:[string] = // ???? 

how can convert javautillist objective-c/swift nsarray?

you use iterator cycle through every item:

static inline nsarray *arraywithjavautillist(id <javautillist> list) {     nsmutablearray *array = [[nsmutablearray alloc] init];     id <javautiliterator> iterator = [list iterator];     while ([iterator hasnext]) {         id object = [iterator next];         [array addobject:object];     }      return [nsarray arraywitharray:array]; } 

Comments

Popular posts from this blog

css - SVG using textPath a symbol not rendering in Firefox -

Java 8 + Maven Javadoc plugin: Error fetching URL -

datatable - Matlab struct computations -