What is the difference between valueOfand copyValueOf. I looked at GrepCode, only to find that both return the same.
valueOf
copyValueOf
copyValueOf:
Parameters : data - an array of characters.Returns : A string containing the characters of an array of characters.public static String copyValueOf (char data []) {return new String (data); }
Parameters : data - an array of characters.
Returns : A string containing the characters of an array of characters.
public static String copyValueOf (char data []) {return new String (data); }
valueOf:
Returns a string representation of the argument of the char array. The contents of the character array are copied; subsequent modification of the character array does not affect the returned string.Parameters : character array data.Returns : A string containing the characters of an array of characters.public static String valueOf (char data []) {return new String (data); }
Returns a string representation of the argument of the char array. The contents of the character array are copied; subsequent modification of the character array does not affect the returned string.
Parameters : character array data.
public static String valueOf (char data []) {return new String (data); }
So, if both do the same thing, then why is one not obsolete?
:
, "". , , , API-, . , Java ... , -- API " ", .. (Most , Java . , Java, .)
-, , ( ) . Oracle... (@StarCoder) , .
, @Deprecated, , , , , , , . , ( ).
; . , , .
, ( String.java - ):
copyValueOf (char data []): , . .
valueOf (char data []): , . String (.. ).
redudndency . java . , , , .
Source: https://habr.com/ru/post/1691836/More articles:How to convey props style for a specific component in a reaction-native - reactjsHow can I combine a React element and text inside a triple? - ternaryHow to use std :: lock_guard without breaking const? - c ++Why does it still work without installing AndroidInjectionModule? - dagger-2How can I use bearer token authentication to access the report server, where the report opens on different tabs? - angularjsCSS Responsive design for high and low peak density devices? - cssUnable to use CLI / command line after ng service - angularCallState response callState not called for external (npm packaged) component - reactjsHow to remove border selection on after clicking - htmlIf a CancellationToken is a structure and passed in a value, how is it updated? - parameter-passingAll Articles