function List(){this.elements=new Array()
}List.prototype.size=function(){return this.elements.length
};
List.prototype.isEmpty=function(){return(this.elements.length==0)
};
List.prototype.add=function(value,index){if(value){with(this){if(isNaN(index)||!checkIndex(index)){index=elements.length
}if(index<elements.length){for(var i=elements.length;
i>index;
i--){elements[i]=elements[i-1]
}}elements[index]=value
}}};
List.prototype.set=function(B,A){if(B&&!isNaN(A)&&this.checkIndex(A)){this.elements[A]=B
}};
List.prototype.get=function(index){with(this){if(isNaN(index)){return first()
}return(checkIndex(index))?elements[index]:null
}};
List.prototype.first=function(){with(this){return(isEmpty())?null:get(0)
}};
List.prototype.last=function(){with(this){return(isEmpty())?null:get(elements.length-1)
}};
List.prototype.remove=function(index){if(isNaN(index)){index=0
}var obj=null;
with(this){if(checkIndex(index)){obj=elements[index];
for(var j=index;
j<(elements.length-1);
j++){elements[j]=elements[j+1]
}elements.length-=1
}}return obj
};
List.prototype.contains=function(A){return(this.indexOf(A)!=-1)
};
List.prototype.indexOf=function(value){if(value){with(this){for(var i=0;
i<elements.length;
i++){if(elements[i]==value){return i
}}}}return -1
};
List.prototype.lastIndexOf=function(value){if(value){with(this){for(var i=(elements.length-1);
i>=0;
i--){if(elements[i]==value){return i
}}}}return -1
};
List.prototype.sort=function(A){if(A&&A!=null){this.elements.sort(A)
}else{this.elements.sort()
}};
List.prototype.clear=function(){this.elements.length=0
};
List.prototype.checkIndex=function(A){return(A>=0&&A<this.elements.length)
};
List.prototype.toString=function(){return"[object List]"
};