Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-1542

Implement groupBy() for Maps as well as for Lists

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 1.0-JSR-6
    • 1.1-beta-2
    • groovy-jdk
    • None
    • All

    Description

      The method groupBy() works only for lists. It should work for Maps as well.

      The code for this functionality and the respective test is commented out in DefaultGroovyMethods and GroovyMethodsTest.

      public static Map groupBy(Map self, Closure closure) {
      final Map answer = new HashMap();
      for (final Iterator iter = self.entrySet().iterator(); iter.hasNext()

      { groupCurrentElement(closure, answer, iter); }

      return answer;
      }

      Attachments

        Activity

          People

            jbaumann Joachim Baumann
            jbaumann Joachim Baumann
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: