PageRenderTime 4931ms CodeModel.GetById 54ms RepoModel.GetById 2ms app.codeStats 0ms

/deploy/doc/apidoc/org/as3commons/collections/utils/Lists.html

http://github.com/AS3Commons/as3commons-collections
HTML | 752 lines | 672 code | 71 blank | 9 comment | 0 complexity | 4266369e45e926a8c074ce3ab75d0b08 MD5 | raw file
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <head>
  4. <META http-equiv="Content-Type" content="text/html; charset=UTF-8">
  5. <link rel="stylesheet" href="../../../../style.css" type="text/css" media="screen">
  6. <link rel="stylesheet" href="../../../../print.css" type="text/css" media="print">
  7. <meta content="Lists,org.as3commons.collections.utils.Lists,addFromArgs,addFromArray,addFromCollection,clone,copy,newArrayList,newSortedList" name="keywords">
  8. <title>org.as3commons.collections.utils.Lists</title>
  9. </head>
  10. <body>
  11. <script type="text/javascript" language="javascript" src="../../../../asdoc.js"></script><script type="text/javascript" language="javascript" src="../../../../cookies.js"></script><script type="text/javascript" language="javascript">
  12. <!--
  13. asdocTitle = 'Lists - AS3Commons Collections 1.3.2';
  14. var baseRef = '../../../../';
  15. window.onload = configPage;
  16. --></script>
  17. <table style="display:none" id="titleTable" cellspacing="0" cellpadding="0" class="titleTable">
  18. <tr>
  19. <td align="left" class="titleTableTitle">AS3Commons Collections 1.3.2</td><td align="right" class="titleTableTopNav"><a onclick="loadClassListFrame('../../../../all-classes.html')" href="../../../../package-summary.html">All&nbsp;Packages</a>&nbsp;|&nbsp;<a onclick="loadClassListFrame('../../../../all-classes.html')" href="../../../../class-summary.html">All&nbsp;Classes</a>&nbsp;|&nbsp;<a onclick="loadClassListFrame('../../../../index-list.html')" href="../../../../all-index-A.html">Index</a>&nbsp;|&nbsp;<a href="../../../../index.html?org/as3commons/collections/utils/Lists.html&amp;org/as3commons/collections/utils/class-list.html" id="framesLink1">Frames</a><a onclick="parent.location=document.location" href="" style="display:none" id="noFramesLink1">No&nbsp;Frames</a></td><td rowspan="3" align="right" class="titleTableLogo"><img alt="Adobe Logo" title="Adobe Logo" class="logoImage" src="../../../../images/logo.jpg"></td>
  20. </tr>
  21. <tr class="titleTableRow2">
  22. <td align="left" id="subTitle" class="titleTableSubTitle">Class&nbsp;Lists</td><td align="right" id="subNav" class="titleTableSubNav"><a href="#methodSummary">Methods</a></td>
  23. </tr>
  24. <tr class="titleTableRow3">
  25. <td colspan="2">&nbsp;</td>
  26. </tr>
  27. </table>
  28. <script type="text/javascript" language="javascript">
  29. <!--
  30. if (!isEclipse() || window.name != ECLIPSE_FRAME_NAME) {titleBar_setSubTitle("Class Lists"); titleBar_setSubNav(false,false,false,false,false,false,true,false,false,false,false,false,false,false);}
  31. --></script>
  32. <div class="MainContent">
  33. <table cellspacing="0" cellpadding="0" class="classHeaderTable">
  34. <tr>
  35. <td class="classHeaderTableLabel">Package</td><td><a onclick="javascript:loadClassListFrame('class-list.html')" href="package-detail.html">org.as3commons.collections.utils</a></td>
  36. </tr>
  37. <tr>
  38. <td class="classHeaderTableLabel">Class</td><td class="classSignature">public class Lists</td>
  39. </tr>
  40. </table>
  41. <p></p>
  42. <code>IList</code> utilities.
  43. <p id="link_ListsAddFromExample"><strong><code>Lists.addFrom...()</code> example</strong></p>
  44. <a class="exampleCollapsed" href="#link_ListsAddFromExample" onClick="toggleExample(this, 'ListsAddFromExample');">Show example</a><br /><div id="ListsAddFromExample" style='display:none'><div class='listing'><pre>package {
  45. import org.as3commons.collections.ArrayList;
  46. import org.as3commons.collections.LinkedList;
  47. import org.as3commons.collections.Map;
  48. import org.as3commons.collections.utils.Lists;
  49. import flash.display.Sprite;
  50. public class ListsAddFromExample extends Sprite {
  51. public function ListsAddFromExample() {
  52. // list to populate
  53. var list : ArrayList = new ArrayList();
  54. // from array (ordered)
  55. var a : Array = [1, "2", "2"];
  56. Lists.addFromArray(list, a);
  57. // from linked list (ordered)
  58. var l : LinkedList = new LinkedList();
  59. l.add("2");
  60. l.add(3);
  61. l.add("4");
  62. l.add(3);
  63. Lists.addFromCollection(list, l);
  64. // from map (no order)
  65. var m : Map = new Map();
  66. m.add("five", 5);
  67. m.add("six", "6");
  68. m.add("four", "4");
  69. Lists.addFromCollection(list, m);
  70. // from args (ordered)
  71. Lists.addFromArgs(list,
  72. 7, "8", "8", 5
  73. );
  74. // test
  75. trace (list.toArray().join("n"));
  76. // 1 // from array
  77. // 2
  78. // 2
  79. // 2 // from linked list
  80. // 3
  81. // 4
  82. // 3
  83. // 4 // from map
  84. // 6
  85. // 5
  86. // 7 // from args
  87. // 8
  88. // 8
  89. // 5
  90. }
  91. }
  92. }
  93. </pre></div></div>
  94. <p id="link_ListsCloneExample"><strong><code>Lists.clone()</code> example</strong></p>
  95. <a class="exampleCollapsed" href="#link_ListsCloneExample" onClick="toggleExample(this, 'ListsCloneExample');">Show example</a><br /><div id="ListsCloneExample" style='display:none'><div class='listing'><pre>package {
  96. import org.as3commons.collections.utils.NumericComparator;
  97. import flash.utils.getQualifiedClassName;
  98. import org.as3commons.collections.framework.IList;
  99. import org.as3commons.collections.utils.Lists;
  100. import flash.display.Sprite;
  101. public class ListsCloneExample extends Sprite {
  102. public function ListsCloneExample() {
  103. // clone array list
  104. var list : IList = Lists.newArrayList(2, 4, 1, 3);
  105. var clone : IList = Lists.clone(list);
  106. trace (list.toArray().join("n"));
  107. trace (getQualifiedClassName(clone));
  108. // 2
  109. // 4
  110. // 1
  111. // 3
  112. // org.as3commons.collections::ArrayList
  113. // clone sorted list
  114. list = Lists.newSortedList(
  115. new NumericComparator(),
  116. 2, 4, 1, 3
  117. );
  118. clone = Lists.clone(list);
  119. trace (list.toArray().join("n"));
  120. trace (getQualifiedClassName(clone));
  121. // 1
  122. // 2
  123. // 3
  124. // 4
  125. // org.as3commons.collections::SortedList
  126. }
  127. }
  128. }
  129. </pre></div></div>
  130. <p id="link_ListsCopyExample"><strong><code>Lists.copy()</code> example</strong></p>
  131. <a class="exampleCollapsed" href="#link_ListsCopyExample" onClick="toggleExample(this, 'ListsCopyExample');">Show example</a><br /><div id="ListsCopyExample" style='display:none'><div class='listing'><pre>package {
  132. import org.as3commons.collections.framework.IList;
  133. import org.as3commons.collections.utils.Lists;
  134. import org.as3commons.collections.utils.NumericComparator;
  135. import flash.display.Sprite;
  136. public class ListsCopyExample extends Sprite {
  137. public function ListsCopyExample() {
  138. // source
  139. var source : IList = Lists.newArrayList(1, 2, 3, 4);
  140. trace (source.toArray() + "n");
  141. // 1, 2, 3, 4
  142. // copy all
  143. var list : IList = Lists.newSortedList(
  144. new NumericComparator(),
  145. 5, 6, 7, 8
  146. );
  147. trace (list.toArray() + "n");
  148. // 5, 6, 7, 8
  149. Lists.copy(source, list);
  150. trace (list.toArray() + "n");
  151. // 1, 2, 3, 4, 5, 6, 7, 8
  152. // copy only even items
  153. list = Lists.newSortedList(
  154. new NumericComparator(),
  155. 6, 8
  156. );
  157. trace (list.toArray() + "n");
  158. // 6, 8
  159. Lists.copy(source, list, evenFilter);
  160. trace (list.toArray() + "n");
  161. // 2, 4, 6, 8
  162. }
  163. private function evenFilter(item : : Boolean {
  164. return item % 2 == 0;
  165. }
  166. }
  167. }
  168. </pre></div></div>
  169. <p id="link_AddFromArgsExample"><strong><code>Lists.new...()</code> example</strong></p>
  170. <a class="exampleCollapsed" href="#link_AddFromArgsExample" onClick="toggleExample(this, 'AddFromArgsExample');">Show example</a><br /><div id="AddFromArgsExample" style='display:none'><div class='listing'><pre>package {
  171. import org.as3commons.collections.framework.
  172. import org.as3commons.collections.utils.
  173. import flash.display.Sprite;
  174. public class AddFromArgsExample extends Sprite {
  175. public function AddFromArgsExample() {
  176. // ArrayList
  177. var list : IList = Lists.newArrayList(
  178. 1, 2, 3, 4, 5, 6, 7, 8
  179. );
  180. trace (list.toArray() + "n");
  181. // 1, 2, 3, 4, 5, 6, 7, 8
  182. // ArrayList
  183. list = Lists.newSortedList(
  184. new NumericComparator(),
  185. 6, 3, 1, 5, 8, 2, 7, 4
  186. );
  187. trace (list.toArray() + "n");
  188. // 1, 2, 3, 4, 5, 6, 7, 8
  189. // Set
  190. var theSet : ISet = Sets.newSet(
  191. 1, 2, 3, 4, 5, 6, 7, 8
  192. );
  193. trace (theSet.toArray() + "n");
  194. // 1, 2, 3, 4, 5, 6, 7, 8
  195. // LinkedSet
  196. theSet = Sets.newLinkedSet(
  197. 1, 2, 3, 4, 5, 6, 7, 8
  198. );
  199. trace (theSet.toArray() + "n");
  200. // 1, 2, 3, 4, 5, 6, 7, 8
  201. // SortedSet
  202. theSet = Sets.newSortedSet(
  203. new NumericComparator(),
  204. 6, 3, 1, 5, 8, 2, 7, 4
  205. );
  206. trace (theSet.toArray() + "n");
  207. // 1, 2, 3, 4, 5, 6, 7, 8
  208. // Map
  209. var map : IMap = Maps.newMap(
  210. "one", 1, "two", 2, "three", 3, "four", 4
  211. );
  212. trace (map.toArray() + "n");
  213. // 1, 4, 2, 3
  214. // LinkedMap
  215. map = Maps.newLinkedMap(
  216. "one", 1, "two", 2, "three", 3, "four", 4
  217. );
  218. trace (map.toArray() + "n");
  219. // 1, 2, 3, 4
  220. // SortedMap
  221. map = Maps.newSortedMap(
  222. new NumericComparator(),
  223. "one", 1, "two", 2, "three", 3, "four", 4
  224. );
  225. trace (map.toArray() + "n");
  226. // 1, 2, 3, 4
  227. // LinkedList
  228. var linkedList : ILinkedList = LinkedLists.newLinkedList(
  229. 1, 2, 3, 4, 5, 6, 7, 8
  230. );
  231. trace (linkedList.toArray() + "n");
  232. // 1, 2, 3, 4, 5, 6, 7, 8
  233. }
  234. }
  235. }
  236. </pre></div></div>
  237. <p id="link_NestedCollectionsExample"><strong>Nested collections example</strong></p>
  238. <a class="exampleCollapsed" href="#link_NestedCollectionsExample" onClick="toggleExample(this, 'NestedCollectionsExample');">Show example</a><br /><div id="NestedCollectionsExample" style='display:none'><div class='listing'><pre>package {
  239. import org.as3commons.collections.ArrayList;
  240. import org.as3commons.collections.LinkedSet;
  241. import org.as3commons.collections.framework.IComparator;
  242. import org.as3commons.collections.utils.
  243. import flash.display.Sprite;
  244. public class NestedCollectionsExample extends Sprite {
  245. public function NestedCollectionsExample() {
  246. // nested array list
  247. var list : ArrayList = Lists.newArrayList(
  248. Lists.newArrayList(1, 2),
  249. Lists.newArrayList(
  250. Lists.newArrayList(3, 4),
  251. Lists.newArrayList(5, 6)
  252. ),
  253. Lists.newArrayList(7, 8),
  254. Lists.newArrayList(
  255. Lists.newArrayList(9, 10),
  256. Lists.newArrayList(11, 12)
  257. )
  258. );
  259. trace (CollectionUtils.dumpAsString(list));
  260. // [object ArrayList]
  261. // .......[object ArrayList]
  262. // ..............1
  263. // ..............2
  264. // .......[object ArrayList]
  265. // ..............[object ArrayList]
  266. // .....................3
  267. // .....................4
  268. // ..............[object ArrayList]
  269. // .....................5
  270. // .....................6
  271. // .......[object ArrayList]
  272. // ..............7
  273. // ..............8
  274. // .......[object ArrayList]
  275. // ..............[object ArrayList]
  276. // .....................9
  277. // .....................10
  278. // ..............[object ArrayList]
  279. // .....................11
  280. // .....................12
  281. // nested mixed collection
  282. var c : IComparator = new NumericComparator();
  283. var theSet : LinkedSet = Sets.newLinkedSet(
  284. Maps.newLinkedMap("one", 1, "two", 2),
  285. Lists.newArrayList(
  286. Sets.newSortedSet(c, 4, 3),
  287. LinkedLists.newLinkedList(5, 6)
  288. ),
  289. Lists.newSortedList(c, 8, 7),
  290. Lists.newArrayList(
  291. Maps.newLinkedMap("nine", 9, "ten", 10),
  292. Maps.newSortedMap(c, "twelve", 12, "eleven", 11)
  293. )
  294. );
  295. trace (CollectionUtils.dumpAsString(theSet));
  296. // [object LinkedSet]
  297. // .......[object LinkedMap]
  298. // ..............1
  299. // ..............2
  300. // .......[object ArrayList]
  301. // ..............[object SortedSet]
  302. // .....................3
  303. // .....................4
  304. // ..............[object LinkedList]
  305. // .....................5
  306. // .....................6
  307. // .......[object SortedList]
  308. // ..............7
  309. // ..............8
  310. // .......[object ArrayList]
  311. // ..............[object LinkedMap]
  312. // .....................9
  313. // .....................10
  314. // ..............[object SortedMap]
  315. // .....................11
  316. // .....................12
  317. }
  318. }
  319. }
  320. </pre></div></div>
  321. <p></p>
  322. <br>
  323. <hr>
  324. </div>
  325. <a name="methodSummary"></a>
  326. <div class="summarySection">
  327. <div class="summaryTableTitle">Public Methods</div>
  328. <table id="summaryTableMethod" class="summaryTable " cellpadding="3" cellspacing="0">
  329. <tr>
  330. <th>&nbsp;</th><th colspan="2">Method</th><th class="summaryTableOwnerCol">Defined&nbsp;by</th>
  331. </tr>
  332. <tr class="">
  333. <td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
  334. <div class="summarySignature">
  335. <a class="signatureLink" href="#addFromArgs()">addFromArgs</a>(list:<a href="../framework/IList.html">IList</a>, ... args):uint</div>
  336. <div class="summaryTableDescription">[static]
  337. Adds the given list of items to the specified list.</div>
  338. </td><td class="summaryTableOwnerCol">Lists</td>
  339. </tr>
  340. <tr class="">
  341. <td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
  342. <div class="summarySignature">
  343. <a class="signatureLink" href="#addFromArray()">addFromArray</a>(list:<a href="../framework/IList.html">IList</a>, source:Array):uint</div>
  344. <div class="summaryTableDescription">[static]
  345. Adds the contents of the given <code>Array</code> to the specified list.</div>
  346. </td><td class="summaryTableOwnerCol">Lists</td>
  347. </tr>
  348. <tr class="">
  349. <td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
  350. <div class="summarySignature">
  351. <a class="signatureLink" href="#addFromCollection()">addFromCollection</a>(list:<a href="../framework/IList.html">IList</a>, source:<a href="../framework/ICollection.html">ICollection</a>):uint</div>
  352. <div class="summaryTableDescription">[static]
  353. Adds the contents of the given <code>ICollection</code> to the specified list.</div>
  354. </td><td class="summaryTableOwnerCol">Lists</td>
  355. </tr>
  356. <tr class="">
  357. <td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
  358. <div class="summarySignature">
  359. <a class="signatureLink" href="#clone()">clone</a>(list:<a href="../framework/IList.html">IList</a>, filter:Function = null):<a href="../framework/IList.html">IList</a>
  360. </div>
  361. <div class="summaryTableDescription">[static]
  362. Clones the supplied <code>IList</code> instance returning a new <code>IList</code>
  363. of the same type.</div>
  364. </td><td class="summaryTableOwnerCol">Lists</td>
  365. </tr>
  366. <tr class="">
  367. <td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
  368. <div class="summarySignature">
  369. <a class="signatureLink" href="#copy()">copy</a>(source:<a href="../framework/IList.html">IList</a>, destination:<a href="../framework/IList.html">IList</a>, filter:Function = null):uint</div>
  370. <div class="summaryTableDescription">[static]
  371. Copies items from one list to another.</div>
  372. </td><td class="summaryTableOwnerCol">Lists</td>
  373. </tr>
  374. <tr class="">
  375. <td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
  376. <div class="summarySignature">
  377. <a class="signatureLink" href="#newArrayList()">newArrayList</a>(... args):<a href="../../collections/ArrayList.html">ArrayList</a>
  378. </div>
  379. <div class="summaryTableDescription">[static]
  380. Creates, populates and returns a new <code>ArrayList</code> instance.</div>
  381. </td><td class="summaryTableOwnerCol">Lists</td>
  382. </tr>
  383. <tr class="">
  384. <td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
  385. <div class="summarySignature">
  386. <a class="signatureLink" href="#newSortedList()">newSortedList</a>(comparator:<a href="../framework/IComparator.html">IComparator</a>, ... args):<a href="../../collections/SortedList.html">SortedList</a>
  387. </div>
  388. <div class="summaryTableDescription">[static]
  389. Creates, populates and returns a new <code>ArrayList</code> instance.</div>
  390. </td><td class="summaryTableOwnerCol">Lists</td>
  391. </tr>
  392. </table>
  393. </div>
  394. <script type="text/javascript" language="javascript">
  395. <!--
  396. showHideInherited();
  397. --></script>
  398. <div class="MainContent">
  399. <a name="methodDetail"></a>
  400. <div class="detailSectionHeader">Method detail</div>
  401. <a name="addFromArgs()"></a>
  402. <table cellspacing="0" cellpadding="0" class="detailHeader">
  403. <tr>
  404. <td class="detailHeaderName">addFromArgs</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td>
  405. </tr>
  406. </table>
  407. <div class="detailBody">
  408. <code>public static function addFromArgs(list:<a href="../framework/IList.html">IList</a>, ... args):uint</code><p>
  409. Adds the given list of items to the specified list.
  410. <div class='listing'><pre>
  411. Lists.addFromArgs(myList, item1, item2, ...);
  412. </pre></div>
  413. </p><span class="label">Parameters</span>
  414. <table border="0" cellspacing="0" cellpadding="0">
  415. <tr>
  416. <td width="20px"></td><td><code><span class="label">list</span>:<a href="../framework/IList.html">IList</a></code> &mdash; The list to populate.
  417. </td>
  418. </tr>
  419. <tr>
  420. <td class="paramSpacer">&nbsp;</td>
  421. </tr>
  422. <tr>
  423. <td width="20px"></td><td><code>... <span class="label">args</span></code> &mdash; List of items to add to the list.
  424. </td>
  425. </tr>
  426. </table>
  427. <p></p>
  428. <span class="label">Returns</span>
  429. <table border="0" cellspacing="0" cellpadding="0">
  430. <tr>
  431. <td width="20"></td><td><code>uint</code> &mdash; The number of items added to the list.
  432. </td>
  433. </tr>
  434. </table>
  435. </div>
  436. <a name="addFromArray()"></a>
  437. <table cellspacing="0" cellpadding="0" class="detailHeader">
  438. <tr>
  439. <td class="detailHeaderName">addFromArray</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
  440. </tr>
  441. </table>
  442. <div class="detailBody">
  443. <code>public static function addFromArray(list:<a href="../framework/IList.html">IList</a>, source:Array):uint</code><p>
  444. Adds the contents of the given <code>Array</code> to the specified list.
  445. <div class='listing'><pre>
  446. var array : Array = [item1, item2, ...];
  447. var count : uint = Lists.addFromArray(list, array);
  448. </pre></div>
  449. </p><span class="label">Parameters</span>
  450. <table border="0" cellspacing="0" cellpadding="0">
  451. <tr>
  452. <td width="20px"></td><td><code><span class="label">list</span>:<a href="../framework/IList.html">IList</a></code> &mdash; The list to populate.
  453. </td>
  454. </tr>
  455. <tr>
  456. <td class="paramSpacer">&nbsp;</td>
  457. </tr>
  458. <tr>
  459. <td width="20px"></td><td><code><span class="label">source</span>:Array</code> &mdash; The <code>Array</code> to add from.
  460. </td>
  461. </tr>
  462. </table>
  463. <p></p>
  464. <span class="label">Returns</span>
  465. <table border="0" cellspacing="0" cellpadding="0">
  466. <tr>
  467. <td width="20"></td><td><code>uint</code> &mdash; The number of items added to the list.
  468. </td>
  469. </tr>
  470. </table>
  471. </div>
  472. <a name="addFromCollection()"></a>
  473. <table cellspacing="0" cellpadding="0" class="detailHeader">
  474. <tr>
  475. <td class="detailHeaderName">addFromCollection</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
  476. </tr>
  477. </table>
  478. <div class="detailBody">
  479. <code>public static function addFromCollection(list:<a href="../framework/IList.html">IList</a>, source:<a href="../framework/ICollection.html">ICollection</a>):uint</code><p>
  480. Adds the contents of the given <code>ICollection</code> to the specified list.
  481. <div class='listing'><pre>
  482. var count : uint = Lists.addFromCollection(list, sourceCollection);
  483. </pre></div>
  484. </p><span class="label">Parameters</span>
  485. <table border="0" cellspacing="0" cellpadding="0">
  486. <tr>
  487. <td width="20px"></td><td><code><span class="label">list</span>:<a href="../framework/IList.html">IList</a></code> &mdash; The list to populate.
  488. </td>
  489. </tr>
  490. <tr>
  491. <td class="paramSpacer">&nbsp;</td>
  492. </tr>
  493. <tr>
  494. <td width="20px"></td><td><code><span class="label">source</span>:<a href="../framework/ICollection.html">ICollection</a></code> &mdash; The <code>ICollection</code> to add from.
  495. </td>
  496. </tr>
  497. </table>
  498. <p></p>
  499. <span class="label">Returns</span>
  500. <table border="0" cellspacing="0" cellpadding="0">
  501. <tr>
  502. <td width="20"></td><td><code>uint</code> &mdash; The number of items added to the list.
  503. </td>
  504. </tr>
  505. </table>
  506. </div>
  507. <a name="clone()"></a>
  508. <table cellspacing="0" cellpadding="0" class="detailHeader">
  509. <tr>
  510. <td class="detailHeaderName">clone</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
  511. </tr>
  512. </table>
  513. <div class="detailBody">
  514. <code>public static function clone(list:<a href="../framework/IList.html">IList</a>, filter:Function = null):<a href="../framework/IList.html">IList</a></code><p>
  515. Clones the supplied <code>IList</code> instance returning a new <code>IList</code>
  516. of the same type.
  517. </p><p>If a filter is specified the resulting list only contains items that
  518. meet the supplied predicates.<p>
  519. <p>The filter function accepts the current item and returns a boolean
  520. value (<code>true</code> if the item is accepted).</p>
  521. <div class='listing'><pre>
  522. function itemFilter(item : : Boolean {
  523. var accept : Boolean = false;
  524. // test the item
  525. return accept;
  526. }
  527. var list : IList = Lists.clone(list, filter);
  528. </pre></div>
  529. <span class="label">Parameters</span>
  530. <table border="0" cellspacing="0" cellpadding="0">
  531. <tr>
  532. <td width="20px"></td><td><code><span class="label">list</span>:<a href="../framework/IList.html">IList</a></code> &mdash; The <code>IList</code> instance to clone.
  533. </td>
  534. </tr>
  535. <tr>
  536. <td class="paramSpacer">&nbsp;</td>
  537. </tr>
  538. <tr>
  539. <td width="20px"></td><td><code><span class="label">filter</span>:Function</code> (default = <code>null</code>)<code></code> &mdash; Function which will be applied to each item in the source list.
  540. </td>
  541. </tr>
  542. </table>
  543. <p></p>
  544. <span class="label">Returns</span>
  545. <table border="0" cellspacing="0" cellpadding="0">
  546. <tr>
  547. <td width="20"></td><td><code><a href="../framework/IList.html">IList</a></code> &mdash;
  548. A new <code>IList</code> instance.
  549. </td>
  550. </tr>
  551. </table>
  552. </div>
  553. <a name="copy()"></a>
  554. <table cellspacing="0" cellpadding="0" class="detailHeader">
  555. <tr>
  556. <td class="detailHeaderName">copy</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
  557. </tr>
  558. </table>
  559. <div class="detailBody">
  560. <code>public static function copy(source:<a href="../framework/IList.html">IList</a>, destination:<a href="../framework/IList.html">IList</a>, filter:Function = null):uint</code><p>
  561. Copies items from one list to another.
  562. </p><p>If a filter is specified only items are copied that meet the
  563. supplied predicates.<p>
  564. <p>The filter function accepts the current item and returns a boolean
  565. value (<code>true</code> if the item is accepted).</p>
  566. <div class='listing'><pre>
  567. function itemFilter(item : : Boolean {
  568. var accept : Boolean = false;
  569. // test the item
  570. return accept;
  571. }
  572. Lists.copy(sourceList, destinationList, filter);
  573. </pre></div>
  574. <span class="label">Parameters</span>
  575. <table border="0" cellspacing="0" cellpadding="0">
  576. <tr>
  577. <td width="20px"></td><td><code><span class="label">source</span>:<a href="../framework/IList.html">IList</a></code> &mdash; The <code>IList</code> instance to copy from.
  578. </td>
  579. </tr>
  580. <tr>
  581. <td class="paramSpacer">&nbsp;</td>
  582. </tr>
  583. <tr>
  584. <td width="20px"></td><td><code><span class="label">destination</span>:<a href="../framework/IList.html">IList</a></code> &mdash; The <code>IList</code> to copy to.
  585. </td>
  586. </tr>
  587. <tr>
  588. <td class="paramSpacer">&nbsp;</td>
  589. </tr>
  590. <tr>
  591. <td width="20px"></td><td><code><span class="label">filter</span>:Function</code> (default = <code>null</code>)<code></code> &mdash; Function which will be applied to each item in the source list.
  592. </td>
  593. </tr>
  594. </table>
  595. <p></p>
  596. <span class="label">Returns</span>
  597. <table border="0" cellspacing="0" cellpadding="0">
  598. <tr>
  599. <td width="20"></td><td><code>uint</code> &mdash; The number of items copied to the list.
  600. </td>
  601. </tr>
  602. </table>
  603. </div>
  604. <a name="newArrayList()"></a>
  605. <table cellspacing="0" cellpadding="0" class="detailHeader">
  606. <tr>
  607. <td class="detailHeaderName">newArrayList</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
  608. </tr>
  609. </table>
  610. <div class="detailBody">
  611. <code>public static function newArrayList(... args):<a href="../../collections/ArrayList.html">ArrayList</a></code><p>
  612. Creates, populates and returns a new <code>ArrayList</code> instance.
  613. </p><p>The arguments may be left out. In that case no item is added to the list.</p>
  614. <div class='listing'><pre>
  615. var list : ArrayList = Lists.newArrayList(item1, item2, ...);
  616. </pre></div>
  617. <span class="label">Parameters</span>
  618. <table border="0" cellspacing="0" cellpadding="0">
  619. <tr>
  620. <td width="20px"></td><td><code>... <span class="label">args</span></code> &mdash; List of items to add to the list.
  621. </td>
  622. </tr>
  623. </table>
  624. <p></p>
  625. <span class="label">Returns</span>
  626. <table border="0" cellspacing="0" cellpadding="0">
  627. <tr>
  628. <td width="20"></td><td><code><a href="../../collections/ArrayList.html">ArrayList</a></code> &mdash;
  629. A new <code>ArrayList</code> instance populated from the given arguments.
  630. </td>
  631. </tr>
  632. </table>
  633. </div>
  634. <a name="newSortedList()"></a>
  635. <table cellspacing="0" cellpadding="0" class="detailHeader">
  636. <tr>
  637. <td class="detailHeaderName">newSortedList</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
  638. </tr>
  639. </table>
  640. <div class="detailBody">
  641. <code>public static function newSortedList(comparator:<a href="../framework/IComparator.html">IComparator</a>, ... args):<a href="../../collections/SortedList.html">SortedList</a></code><p>
  642. Creates, populates and returns a new <code>ArrayList</code> instance.
  643. </p><p>The arguments may be left out. In that case no item is added to the list.</p>
  644. <div class='listing'><pre>
  645. var list : ArrayList = Lists.newSortedList(comparator, item1, item2, ...);
  646. </pre></div>
  647. <span class="label">Parameters</span>
  648. <table border="0" cellspacing="0" cellpadding="0">
  649. <tr>
  650. <td width="20px"></td><td><code><span class="label">comparator</span>:<a href="../framework/IComparator.html">IComparator</a></code> &mdash; List of items to add to the list.
  651. </td>
  652. </tr>
  653. <tr>
  654. <td class="paramSpacer">&nbsp;</td>
  655. </tr>
  656. <tr>
  657. <td width="20px"></td><td><code>... <span class="label">args</span></code> &mdash; The sort criterion.
  658. </td>
  659. </tr>
  660. </table>
  661. <p></p>
  662. <span class="label">Returns</span>
  663. <table border="0" cellspacing="0" cellpadding="0">
  664. <tr>
  665. <td width="20"></td><td><code><a href="../../collections/SortedList.html">SortedList</a></code> &mdash;
  666. A new <code>SortedList</code> instance populated from the given arguments.
  667. </td>
  668. </tr>
  669. </table>
  670. </div>
  671. <br>
  672. <br>
  673. <hr>
  674. <br>
  675. <p></p>
  676. <center class="copyright">
  677. </center>
  678. </div>
  679. </body>
  680. </html>
  681. <!-- -->