javascript ArrayList() function
ジャバスクリプト 関数で ArrayListを 具現して おいた のです.
必要な 時が ある 指導 分からなくて リンクします.
http://www.koders.com/javascript/fid32ECAD6CCE114257D4044549E14ABCEC1332DF7E.aspx#L2
これ ページで 提供する のは ArrayListだけ なく
ArrayList.js
AssertUtil.js
Collection.js
DomUtil.js
EventDispatcher.js
EventWrapper.js
Exceptions.js
Logger.js
Map.js
StringUtil.js
こんなに 多様です.
[#M_広げておく.. | 折っておく.. |
function ArrayList() { this.array = new Array(); this.add = function(obj){ this.array[this.array.length] = obj; } this.iterator = function (){ return new Iterator(this) } this.length = function (){ return this.array.length; } this.get = function (index){ return this.array[index]; } this.addAll = function (obj) { if (obj instanceof Array){ for (var i=0;i<obj.length;i++) { this.add(obj[i]); } } else if (obj instanceof ArrayList){ for (var i=0;i<obj.length();i++) { this.add(obj.get(i)); } } } } function Iterator (arrayList){ this.arrayList; this.index = 0; this.hasNext = function (){ return this.index < this.arrayList.length(); } this.next = function() { return this.arrayList.get(index++); } }
_M#]
- コメント機能はありません。コメントの代わりに[email protected]
にメールを送ってください。