[View]  [Edit]  [Lock]  [References]  [Attachments]  [History]  [Home]  [Changes]  [Search]  [Help] 

test[jx8-android] 033 - ArrayList



"ArrayList (async)"
| list1 list3 constructor |
list1 := Java current newInstance: 'java.util.ArrayList'.
self print: 'Size after creation=' ,list1 handle size.
list1 handle #add: #item1.
self print: 'Size after add=',list1 handle size.

constructor := (Java current import: 'java.util.ArrayList') handle.
{'	list3 = new constructor();
'}.	list3 #add: #item1.
self print: 'Equals result=',(list3 #equals: list1 json)


"ArrayList (sync) - #needsWork"
Java current newInstance: 'java.util.ArrayList' callback: [:err :list2|
	self print: '//Executing block...'.
	self print: '// err=',(err notNil ifTrue: [err] ifFalse: [#nil]).
	self print: '// list2=',(list2 notNil ifTrue: [#Ok] ifFalse: [#Broken]).
	list2 notNil ifTrue: [
		list2 #add: #item1; #add: #item2.
		self print: 'After sync add size=' ,list2 size
	] ifFalse: [ self print: 'Error: (Sync) instantiation broken' ]
].