
Inline adoc files when they are included exactly once. Also fix language tags because this inlining gives us better information on what language the code is written in.
48 lines
1.1 KiB
Plaintext
48 lines
1.1 KiB
Plaintext
== Why is this an issue?
|
|
|
|
It's slightly more efficient to append single characters to ``++StringBuffer++`` and ``++StringBuilder++`` instances as ``++char++``s, than as ``++String++``s. That is, it's more efficient to put a single ``++char++`` in single quotes, rather than double quotes.
|
|
|
|
|
|
=== Noncompliant code example
|
|
|
|
[source,java]
|
|
----
|
|
StringBuilder sb = new StringBuilder();
|
|
|
|
sb.append("a"); // Noncompliant
|
|
----
|
|
|
|
|
|
=== Compliant solution
|
|
|
|
[source,java]
|
|
----
|
|
StringBuilder sb = new StringBuilder();
|
|
|
|
sb.append('a'); // Noncompliant
|
|
----
|
|
|
|
|
|
ifdef::env-github,rspecator-view[]
|
|
|
|
'''
|
|
== Implementation Specification
|
|
(visible only on this page)
|
|
|
|
=== Message
|
|
|
|
Use single quotes around 'x'.
|
|
|
|
|
|
'''
|
|
== Comments And Links
|
|
(visible only on this page)
|
|
|
|
=== on 16 Jun 2015, 17:03:28 Nicolas Peru wrote:
|
|
I really doubt this one should be activated by default. This is really something that you should activate either, to be anal on your style or because you have a perf critical application that actually cares about this, so any way I would not include it in default profile.
|
|
|
|
=== on 16 Jun 2015, 17:16:31 Ann Campbell wrote:
|
|
done [~nicolas.peru]
|
|
|
|
endif::env-github,rspecator-view[]
|