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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T20:11:13+00:00 2026-05-31T20:11:13+00:00

Function abstraction: public abstract class Function<X, Y> { abstract Y apply(X x); } max

  • 0

Function abstraction:

  public abstract class Function<X, Y> {     
      abstract Y apply(X x);      
  }

max method implementation

public static <V extends Comparable<V>> Function<List<V>, V> max() {

    return new Function<List<V>, V>() {
        @Override
        public V apply(List<V> list) {
            return Collections.max(list);
        }
    };
}

And usage (how it should look like)

Date result = max().apply(datesList);

But I get this error and don’t understand why it requires Object

incompatible types; inferred type argument(s) java.lang.Object do not conform to bounds of type variable(s) V
found   : <V>project.Function<java.util.List<V>,V>
required: java.lang.Object

I have read big amount of similar QA but didn’t get how to fix this.
Thanks.

  • 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-31T20:11:14+00:00Added an answer on May 31, 2026 at 8:11 pm

    Java has a very limited type inference. If you write this:

    Date result = max().apply(datesList);
    

    it is not sophisticated enough to infer the type parameter of the max() method, V, so it takes java.lang.Object instead. You could try this:

    Function<List<Date>, Date> fn = max();
    Date result = fn.apply(dates);
    

    Or, if you want to write it in one line, you could do the following, assuming that your max() method is defined in a class named Example:

    Date result = Example.<Date>max().apply(dates);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've set up an abstract parent class, and a concrete class which extends it.
function returnsAnArray () { return array ('test'); } echo returnsAnArray ()[0]; generates a syntax
function Submit_click() { if (!bValidateFields()) return; } function bValidateFields() { /// <summary>Validation rules</summary> ///
What is the difference between a Class Abstraction and an Object Interfaces in PHP?
Here is my model_users class (the model it extends from doesn't have anything yet
Say I have a class A : class A { public: A(); void fetch_data()
I have a database abstraction layer that starts with a base class like so:
I need to write a class in C++ that would represent an abstraction of
I'm new in Haskell programming. Now i'm learn lambda function and lambda abstractions. And
Suppose I have the following class: public class FixExpr { Expr<FixExpr> in; } Now

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.