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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T16:50:26+00:00 2026-06-18T16:50:26+00:00

Below I have a rough implementation of testing a list lambda functions on an

  • 0

Below I have a rough implementation of testing a list lambda functions on an integer in Python. I know Java currently doesn’t support closures or lambdas (yet), but I’m curious, is this remotely possible in Java?

pos = [lambda x : x > 0, "pos"]
even = [lambda x : x % 2 == 0, "even"]
small = [lambda x : x < 100, "small"]

def pass_test(x, tests):
    if (len(tests) == 0): return []
    else:
        if (tests[0][0](x)): return [tests[0][1]] + pass_test(x, tests[1:])
        else: return pass_test(x, tests[1:])
  • 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-18T16:50:28+00:00Added an answer on June 18, 2026 at 4:50 pm

    Yes, it is possible, along the lines of:

    interface Predicate<A> {
        boolean eval(A argument);
    }
    
    Predicate<Integer> gt0 = new Predicate<Integer>() {
        boolean eval(Integer arg) {
            return arg > 0;
        }
    };
    

    You see, this is a bit verbose, but it does the job.

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

Sidebar

Related Questions

In the below rough sample code of C# I have to declared a string
Both of these examples below have 8 significand digits, but the first case doesn't
If any of the nested div s below have a length longer then an
Below I have a function that animates a div ( container ) either to
Below I have table - Company id name value year 1 IBM 10 2011
Below I have a line of code where it states which Session a user
Below I have written a sample program that I have written to learn about
below i have a code that runs in most of my simple programs ..
Below I have an application. Now on the previous page user types in a
I have below structure <div class=mybox> <div id=imageslide> <a href=><img src=url /></a> </div> </div>

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.