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

No need to write field initializers for default values, and types where the diamond operator could suffice

    XMLWordPrintableJSON

Details

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

    Description

      Lot's of places the fields are initialized to their default values, which is unnecessary verbose:

      long value = 0L;
      String str = null;
      

      which is equivalent with:

      long value;
      String str;
      

      And similarly the type specification can be omitted, as the compiler can calculate it automatically, so instead of

      List<RangerPolicyConditionDef> conditions = new ArrayList<RangerServiceDef.RangerPolicyConditionDef>();
      

      it is suffice to write:

      List<RangerPolicyConditionDef> conditions = new ArrayList<>();
      

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: