Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-46711

Improve data structures util classes (ArrayList, ListUtil, MapUtil...)

    Details

    • Type: Story
    • Status: Closed
    • Priority: Critical
    • Resolution: Completed
    • Affects Version/s: None
    • Fix Version/s: 7.0.0 M3
    • Component/s: Dev Tools
    • Labels:
      None

      Description

      Collections handling classes could be improved, in different ways:

      • More functional oriented methods: it allow developers to produce more compact and expressive code. Also that code is more easy to be parallelized.
      filter(list, predicate or lambda)
      
      is better than
      
      foreach item in list
         if lambda(item)
             filtered_list.add(item)
      
      • Add more convenience methods: default parameters, simpler signature, etc.
      method(param)
      
      is better than
      
      method(param, null, null, -1, null)
      
      • Add more semantic methods: the aim is to produce self-expressive code.
      if exists(list, item) ...
      
      is better than
      
      if count(list, item) > 0 ...
      
      • Reduce side effects: it's always more convenient to create new data structures with the result of some computations instead of modifying the original one
      filtered_list = filter(list)
      
      is better than
      
      filter(list)
      // list is modified at this point
      
      • Use proper abstractions: always use the more generic abstraction available. The use of too specific classes leads to less-reutilizable method
      filter(abstract_list)
      
      is better than
      
      filter(specific_list)
      

        Attachments

          Activity

            People

            Assignee:
            brian.chan Brian Chan
            Reporter:
            jose.navarro José Manuel Navarro (Inactive)
            Recent user:
            Kiyoshi Lee
            Participants of an Issue:
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Packages

                Version Package
                7.0.0 M3