Why "System.arraycopy" uses "Object" instead of "Object[]"?

Arne Deutsch :

Just curious:

Someone knows why the method System.arraycopy uses Object as type for src and dest? Would be perfectly possible to use Object[] instead?

Why define:

arraycopy(Object src, int srcPos, Object dest, int destPos, int length)

instead of

arraycopy(Object[] src, int srcPos, Object[] dest, int destPos, int length)

?

Peter Lawrey :

Primitive array types like boolean[] and double[] do not extend Object[] but they do extend Object

This method allows you to copy any type of array, so the type is Object.

int[] a =
int[] b =
System.arraycopy(a, 0, b, 0, a.length);

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

System.arraycopy() shallow copy or deepcopy with primitive and object references

Why is System.arraycopy not camelCased?

Why is System.arraycopy native in Java?

Why is the object name used in the method of the object instead of this?

Why is it returning address instead of object?

Why do I get [object Object] instead of the object property value?

Why prototype consider in object but not in function instead

Why is a code instead of the string used in RDF for an object?

Why is int[] considered an object instead an array of objects

Why use spring beans instead of object initialization

Why SQL returns an Array instead of an Object?

Why does jQuery return integer instead of object?

Python: why is this array an object instead of a float?

Why use Observable in Angular instead of object reference

Why I should use '->' instead of '.' in a pointer of the object?

Object.assign() - Why call this instead of just assign the object directly

Why does Angular $resource return a Resource object instead of the class object?

Why does `export default` export an object with `default` instead of the object itself?

Why does type(object) return <class 'type'> instead of <class 'object'>?

Why is std::pair from anonymous object copying that object instead of moving?

Why am I getting [object object ] instead of JSON?

Why i receive store object instead my own object (PizzaState)?

Why are many object files linked instead of one large object file?

Why is Angular search filtering by object instead of object data?

Why is react-nestable rendering [object Object] instead of expected JSX?

Why does my HTML constructor object return [object Object] instead of [HTMLElementElement]?

Jquery [object Object] instead of text

<[object Object]> appear instead of downloadurl

Returning Future<Object> instead of Object