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

  • Home
  • SEARCH
  • 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 8568653
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T18:09:34+00:00 2026-06-11T18:09:34+00:00

I have a map like this- def a=[Ak:[data1,col,’ak’],BH:[data2,col,’bh’]] In Another map def b=[:] data

  • 0

I have a map like this-

def a=["Ak":[data1,col,'ak'],"BH":[data2,col,'bh']]

In Another map

def b=[:]

data is inserted using

a.each{key,val->
  def available = val.get(0)
  if (available){
    b[key] = val
  }
}

now acording to this map b i need to assign data in table in view.

My problem is i want to check the data size of both data1 and data2 and display the data with big size each time when a user drill down to the view.

  • 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-06-11T18:09:35+00:00Added an answer on June 11, 2026 at 6:09 pm

    Assuming you mean you want the one with the most data first, you can do (assuming Groovy later than 1.7.9):

    // dummy data
    def data1 = [ 1, 2, 3 ]
    def data2 = [ 5, 6, 7, 8 ]
    def col = 'something'
    
    // original map
    def a=["Ak":[data1,col,'ak'],"BH":[data2,col,'bh']]
    
    
    def b = a.findAll { k, v -> v[ 0 ] }               // Keep those with data
             .collectEntries { k, v -> [ k, v[ 0 ] ] } // Make a new map of key:data
             .sort { -it.value.size() }                // Sort it by data size descending
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Map that uses a Set for the key type, like this:
I have something like this: Map<String, String> myMap = ...; for(String key : myMap.keySet())
I have a recursive data type like this: template<typename T> struct SomeType { std::map<T,
I have a block of code in my view like this: <% @map[value].each do
I have a a map that looks like this: public class VerbResult { @JsonProperty("similarVerbs")
I have a map array with objects stuffed with variables looking like this: var
We have several areas where code like this can be seen public Map extractData(ResultSet
I have something like this: [{'date': 1, 'value':5}, {'date':2,'value':3}, ...] and want to map
I have a class like this: class MyClass{ public: MyClass(int Mode); private: std::map <
I have a string like def data = session=234567893egshdjchasd&userId=12345673456&timeOut=1800000 I want to convert it

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.