本文整理汇总了Java中jdk.nashorn.internal.runtime.ScriptRuntime.EMPTY属性的典型用法代码示例。如果您正苦于以下问题:Java ScriptRuntime.EMPTY属性的具体用法?Java ScriptRuntime.EMPTY怎么用?Java ScriptRuntime.EMPTY使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类jdk.nashorn.internal.runtime.ScriptRuntime
的用法示例。
在下文中一共展示了ScriptRuntime.EMPTY属性的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: NativeArray
NativeArray(final Object[] array) {
this(ArrayData.allocate(array.length));
ArrayData arrayData = this.getArray();
if (array.length > 0) {
arrayData.ensure(array.length - 1);
}
for (int index = 0; index < array.length; index++) {
final Object value = array[index];
if (value == ScriptRuntime.EMPTY) {
arrayData = arrayData.delete(index);
} else {
arrayData = arrayData.set(index, value, false);
}
}
this.setArray(arrayData);
}
示例2: NativeArray
NativeArray(final Object[] array) {
this(ArrayData.allocate(array.length));
ArrayData arrayData = this.getArray();
for (int index = 0; index < array.length; index++) {
final Object value = array[index];
if (value == ScriptRuntime.EMPTY) {
arrayData = arrayData.delete(index);
} else {
arrayData = arrayData.set(index, value, false);
}
}
this.setArray(arrayData);
}
示例3: allocate
/**
* Allocate a new object array.
*
* @param initial object values.
* @return the new array
*/
public static NativeArray allocate(final Object[] initial) {
ArrayData arrayData = ArrayData.allocate(initial);
for (int index = 0; index < initial.length; index++) {
final Object value = initial[index];
if (value == ScriptRuntime.EMPTY) {
arrayData = arrayData.delete(index);
}
}
return new NativeArray(arrayData);
}
示例4: fastPopObject
@Override
public Object fastPopObject() {
if (length() == 0) {
return ScriptRuntime.UNDEFINED;
}
final int newLength = (int)decreaseLength();
final Object elem = array[newLength];
array[newLength] = ScriptRuntime.EMPTY;
return elem;
}
示例5: setEmpty
@Override
public ArrayData setEmpty(final int index) {
array[index] = ScriptRuntime.EMPTY;
return this;
}