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

for consistency, DGM collectEntries should have a Closure.IDENTITY variant

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • 1.8.5, 2.0-beta-2
    • None
    • None

    Description

      Allowing the following:

      def nums = [1, 10, 100, 1000]
      def tuples = nums.collect{ [it, it.toString().size()] }
      assert tuples == [[1, 1], [10, 2], [100, 3], [1000, 4]]
      def map = tuples.collectEntries() // <= proposed variant
      assert map == [1:1, 10:2, 100:3, 1000:4]
      

      Attachments

        Activity

          People

            paulk Paul King
            paulk Paul King
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: