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

Improve codestyle, java api usage

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 0.7.0
    • Fix Version/s: 1.0.0
    • Component/s: Ranger
    • Labels:
    • Flags:
      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

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

              Dates

              • Created:
                Updated:
                Resolved: