UMC.TOSTRINGA UMC.TOSTRING warning appears if there is a call to the toString() method on a string argument. Removing such call can help optimize the code in certain cases. Vulnerability and riskThis method creates extra objects which take up more memory and reduce performance, without any other functional effect. Example 112 ArrayList bool1(String arr[]) { 13 ArrayList res = new ArrayList(); 14 for (int i = 0; i < arr.length; i++) { 15 String b = arr[i]; 16 res.add(b); 17 } 18 return res; 19 } 20 // correct one 21 ArrayList bool2(String arr[]) { 22 ArrayList res = new ArrayList(); 23 for (int i = 0; i < arr.length; i++) { 24 String b = arr[i]; 25 res.add(b.toString()); 26 } 27 return res; 28 } UMC.TOSTRING is reported for line 25: Unnecessary toString() method is called for String argument. Use argument instead |