mirror of
https://github.com/quinton-ashley/java2js
synced 2024-12-29 10:11:54 +01:00
87 lines
1.4 KiB
JavaScript
Executable File
87 lines
1.4 KiB
JavaScript
Executable File
jdk.imports['java.util.AbstractList'].load = async () => {
|
|
const Itr = await jdk.import('java.util.Itr');
|
|
|
|
class AbstractList {
|
|
constructor(content) {
|
|
// TODO
|
|
this.content = content || [];
|
|
}
|
|
|
|
addAll(index, vals) {
|
|
const tempArray = vals.toArray(null);
|
|
for (let i = 0; i < tempArray.length; i++) {
|
|
this.content.push(tempArray[i]);
|
|
}
|
|
return false;
|
|
}
|
|
|
|
clear() {
|
|
this.content = [];
|
|
}
|
|
|
|
poll() {
|
|
return this.content.shift();
|
|
}
|
|
|
|
remove(indexOrElem) {
|
|
this.content.splice(indexOrElem, 1);
|
|
return true;
|
|
}
|
|
|
|
removeAll() {
|
|
this.content = [];
|
|
return true;
|
|
}
|
|
|
|
toArray(a) {
|
|
return this.content;
|
|
}
|
|
|
|
size() {
|
|
return this.content.length;
|
|
}
|
|
|
|
add(index, elem) {
|
|
if (typeof elem !== 'undefined') {
|
|
this.content.splice(index, 0, elem);
|
|
} else {
|
|
this.content.push(index);
|
|
}
|
|
}
|
|
|
|
get(index) {
|
|
return this.content[index];
|
|
}
|
|
|
|
contains(val) {
|
|
return this.content.indexOf(val) != -1;
|
|
}
|
|
|
|
containsAll(elems) {
|
|
return false;
|
|
}
|
|
|
|
isEmpty() {
|
|
return this.content.length == 0;
|
|
}
|
|
|
|
set(index, element) {
|
|
this.content[index] = element;
|
|
return element;
|
|
}
|
|
|
|
indexOf(element) {
|
|
return this.content.indexOf(element);
|
|
}
|
|
|
|
lastIndexOf(element) {
|
|
return this.content.lastIndexOf(element);
|
|
}
|
|
|
|
iterator() {
|
|
return new Itr(this);
|
|
}
|
|
}
|
|
jdk.java.util.AbstractList = AbstractList;
|
|
};
|