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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T08:45:08+00:00 2026-05-23T08:45:08+00:00

I am trying to store a variable with the data type DataType<? extends T>

  • 0

I am trying to store a variable with the data type DataType<? extends T>.
I have tried with DataType<? extends T> var; but it seems not to work.

Storing as DataType<?> var; works, but I can’t cast to DataType<? extends T>.

Is there any possibility to get it working?

EDIT:

Perhaps it will be easier, when I give more information.

I use the AndroidHttpClient in an AsyncTask, which executes different requests in background while showing a ProgressDialog.
I am looking for a simple implementation, which may allow me to transfer ResponseHandler as parameters for the method execute of the HttpClient implementation.

  • 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-23T08:45:08+00:00Added an answer on May 23, 2026 at 8:45 am

    EDIT

    The problem is the parameterized type is declared in the method. You cannot store the parameter with the types you want as a class data member, because there is no way to know the type in the class declaration, because the type information is only determined when the method is called.

    public class Snippet<T> {
    
        private final ResponseHandler<? extends T> var;
    
        public Snippet(ResponseHandler<? extends T> var) {
            super();
            this.var = var;
        }
    
    
        public <U> U execute(ResponseHandler<? extends U> responseHandler) {
            // This class is generic wrt to T, but this method is generice wrt to U.
            // You cannot store the variable passed in here in a data member
            // because the type cannot possible be known at compile time, as it
            // depends on client code calling this method.
            return null;
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been trying to store global variables in form of NSDATE but it
I'm trying to store an xml serialized object in a cookie, but i get
I am trying to store more than 1 data item at a single index
I have a function that takes a struct, and I'm trying to store its
I have spent almost 24hours trying to figure out what I'm doing wrong, but
I'm new to VBA but I'm trying to get a DYMO LabelWriter to work
I have a project with Python 2.7 and SQLite3. I am trying to store
I am trying to store a variable from my database into a JavaScript variable
I'm trying to store the names of some variables inside strings. For example: Dim
I'm trying to store a password in a file that I'd like to retrieve

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.