Uploaded image for project: 'Ranger'
  1. Ranger
  2. RANGER-1377

Improve codestyle, java api usage

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 0.7.0
    • 1.0.0
    • Ranger
    • Patch

    Description

      There are several generally considered best practice writing Java code, it is better to follow them.
      Instead of:

      • var.equals("somestring") use "somestring".equals(var)
      • collection.size() > 0 use !collection.isEmpty()
      • instead of using a for loop to add items to a collection, use 'addAll'
      • str.indexOf("something") >= 0 use str.contains("something")
      • "" + var use String.valueOf(var)
      • stringBuilder.append("a" + b + "c") use stringBuilder.append("a").append(b).append("c")
      • "something "+ a.toString() use "something " + a

      Attachments

        Activity

          People

            zsombor Zsombor Gegesy
            zsombor Zsombor Gegesy
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: