Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7186023
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T18:32:41+00:00 2026-05-28T18:32:41+00:00

I have my logic in my postprocess to process the values of devices and

  • 0

I have my logic in my postprocess to process the values of devices and files as below :(changed this to set from map as it was overriding the values)

def deviceFiles = devices.inject([] as Set) { deviceFiles, device ->
            def v = device.key.split( /\./ )[0]
            deviceFiles << [ (device.value), files[ v ] ]
        }

output : deviceFiles :[[Acer C6, Tetris.apk], [Motorola Droid Milestone, Tetris.apk], [Acer C6, TheSims3.apk], [HTC Desire, TheSims3.apk]] — looks good to be displayed

These values are to be passed as a map/properties so that the data would be displayed properly without any cast exceptions, which I am finding tough..

when it is looped through the set

deviceFiles.each { device  ->
            mapping.put("${device}", "${file}")
        }

output : mapping :[HTC Desire:TheSims3.apk, Motorola Droid Milestone:Tetris.apk, Acer C6:Tetris.apk] — which is not correct (Acer C6:TheSims3.apk has been overriden)

Am I missing something here in sending the expected values into map? or it is not possible to send the values of set through map(as map always eliminates the duplicates when i am iterating through devices) ???

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T18:32:43+00:00Added an answer on May 28, 2026 at 6:32 pm

    You could use collectEntries:

    def deviceFiles = devices.collectEntries {
        device -> [device.value, device.key.split(/\./)[0]]
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have authentication logic that uses cookies. The model attributes are initialized from cookies,
I have some logic that depends upon two properties being set, as it executes
I have: WCF Service [Application 1] Logic communicating with this service [Project1 Application2] Web
My model will have logic that uses Date.current like this: if(date_three && date_three !=
I have a UITableView that loads remote data from the network. I have logic
I have logic consisting of selecting a large number of records from one system,
I have this logic in an extension method that creates a paging wrapper: int
I have a logic-thinking problem. I retrieve data from a php file over json
I have a code as below: Class A{ protected void method1(){ //i have logic
On an Oracle 11g engine using PL/SQL I have logic that runs like this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.