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 108717
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T01:57:21+00:00 2026-05-11T01:57:21+00:00

I have a Set that I need to use the findAll closure upon. The

  • 0

I have a ‘Set’ that I need to use the findAll closure upon. The Set contains objects, not just primitive values. For instance… I have a Set of Employee objects and I need to iterate and grab elements of that Set of Empolyee Objects by attributes of the Employee.

For some reason the findAll closure seems to be just ignore my close and returns an empty set.

Here is my syntax;

dstCollection = srcCollection.findAll{     it.age == 22 } 
  • 1 1 Answer
  • 1 View
  • 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. 2026-05-11T01:57:21+00:00Added an answer on May 11, 2026 at 1:57 am

    The following works for me:

    class Employee {     int age      String toString() {         age     } }  def list = [ new Employee(age:22), new Employee(age:23), new Employee(age:22) ] as Set  println list println list.findAll { it.age == 22 } 

    output:

    [22, 23, 22] [22, 22] 

    Can you post your code?

    Edit: added ‘as Set’, since I noticed the question is about sets and not lists. This also works for me.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a set of parameters that I need to use to access a
I have a set of DAOs ( Data access objects ) that need to
I have a set of conditions that I need to use to retrieve some
I have to write something in vbscript that need to use a unique set.
I have a set of string that I need to store in a set,
I have set inside .bashrc some aliases that I need to be seen inside
I have a set of 'dynamic data' that I need to bind to the
I have a set of WMV files that I need to convert to H.264.
I have a set of images that when moused over need to change to
I have a set of events that reoccur. I need to be able to

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.