TICS Coding Standard Viewer 
TIOBE Software Quality Framework
Print-friendly version
©TIOBE Software www.tiobe.com
 
TIOBE - Java Coding Standard
Search

Rule:  Optimization9Checked automatically with code checker

Synopsis:Unnecessary wrapper object creation
Language:Java
Severity Level:4
Category:Optimization


Description:
Parsing method should be called directy instead.
public int convert(String s) {
  int i, i2;

  i = Integer.valueOf(s).intValue(); // this wastes an object
  i = Integer.parseInt(s); // this is better

  i2 = Integer.valueOf(i).intValue(); // this wastes an object
  i2 = i; // this is better

  return i2;
}