List of usage examples for jdk.nashorn.internal.objects NativeArray construct
@SpecializedFunction(isConstructor = true) public static NativeArray construct(final boolean newObj, final Object self, final double length)
From source file:com.threecrickets.jvm.json.nashorn.NashornJsonImplementation.java
License:Mozilla Public License
public Object createArray(int length) { return NativeArray.construct(true, null, length); }
From source file:com.threecrickets.jvm.json.nashorn.util.NashornNativeUtil.java
License:Mozilla Public License
public static NativeArray newArray(int length) { return (NativeArray) NativeArray.construct(false, null, length); }
From source file:org.bson.jvm.nashorn.NativeArrayCodec.java
License:Apache License
public NativeArray decode(BsonReader reader, DecoderContext decoderContext) { List<Object> list = new ArrayList<Object>(); reader.readStartArray();//from w w w .java2s . c om while (reader.readBsonType() != BsonType.END_OF_DOCUMENT) { Object item = BsonUtil.read(reader, decoderContext, codecRegistry, bsonTypeClassMap); list.add(item); } reader.readEndArray(); NativeArray nativeArray = (NativeArray) NativeArray.construct(true, null, list.size()); int index = 0; for (Object item : list) nativeArray.set(index++, item, 0); return nativeArray; }