javascript - Why doesn't JsArrayString implement iterable? -
quick question here -- used jsarraystring first time, , surprised didn't work:
jsarraystring object = ...; (string s : object)
so wrote c-style loop:
jsarraystring object = ...; (int i=0; i<object.length(); i++) { s = object.get(i) ...
not big deal, seems have been simple gwt team have jsarraystring implement iterable, wanted check , make sure wasn't missing something...
i suspect it's matter of code bloat , matter code size. if make jsarray
implement iterable
, might open door other additions wouldn't useful. jsarray
s meant absolutely simple , barebones possible.
additionally, write own jsiterable
class if want behavior, said should pretty trivial implement.
the lightweight collections design doc addresses of issues around using jre collections , related concepts , discusses features left unsupported ensure absolute minimum code size, including:
until gwt compiler can optimize (which cannot date), new collections not support java enhanced 'for' loop syntax uses iterable/iterator. believe such optimizations possible , added, however, @ time, these collections retrofitted implement iterable.
Comments
Post a Comment