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

Rule:  Optimization5Checked automatically with code checker

Synopsis:This call to String.startsWith can be rewritten using String.charAt(0)
Language:Java
Severity Level:5
Category:Optimization


Description:
Since it passes in a literal of length 1, this call to String.startsWith can be rewritten using String.charAt(0) to save some time.
public class Foo {
  boolean checkIt(String x) {
      return x.startsWith("a");
  }
}