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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T01:03:20+00:00 2026-06-12T01:03:20+00:00

I have seen declarations, interfaces and classes that go TYPE<CLASS> What does this do/mean?

  • 0

I have seen declarations, interfaces and classes that go TYPE<CLASS>

What does this do/mean?

  • 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-12T01:03:21+00:00Added an answer on June 12, 2026 at 1:03 am

    Without evidence, I believe you’re talking about Java’s Generics support…

    Generics allow you to abstract over types

    Before Java 5 it was difficult to provide classes that were capable of supporting multiple different types of Objects without having to code for each specific situation, so it was common for people to pass Object instead.

    This leads to many difficult choices to make at runtime, you’d have to do a runtime check to see if it was possible to cast a given Object to a usable type…for example

    List myIntList = new LinkedList(); // 1
    myIntList.add(new Integer(0)); // 2
    Integer x = (Integer) myIntList.iterator().next(); // 3    
    

    Now, this is reasonably obvious, but if you were passed just a List, you’d have to check each and every element in the list for correctness…

    But now, we can do this…

    List<Integer> myIntList = new LinkedList<Integer>(); // 1'
    myIntList.add(new Integer(0)); // 2'
    Integer x = myIntList.iterator().next(); // 3'
    

    This is a contract that basically says “This list only contains Integer type’s of objects”.

    With generics you can construct a single class that is capable of handling multiple different data types or a family of data types (ie constraint the parameter so that it must be extended from a particular parent type).

    Iterator<? extends Number> itNum;
    

    Basically says, this will contain objects that inherit from Number, include Integer, Long, Double, Float…

    Often in method and class decelerations you will see something similar to…

    public class MyGenericClass<T> {...}
    

    or

    public class MyGenericClass<T extends MyBaseObject> {...}
    

    This allows you to refer to T as if it were a concrete object type, for example…

    public class MyGenericClass<T extends MyBaseObject> {
        private T value;
        public MyGenericClass(T value) {
            this.value = value;
        }
    }
    

    This allows the compiler (and JVM) to essentially “replace” the marker T with a concert type (okay, it’s a little more complicated then that, but that’s the magic)…

    This allows to do things like…

    ... new MyGenericClass<MySuperObject>(new MySuperObject());
    ... new MyGenericClass<MySuperSuperObject>(new MySuperSuperObject());
    

    And know that it will only ever accept the type of object I specify…

    Have a read through the link in the first paragraph, I’m sure it can do more justice then I can 😉

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

Sidebar

Related Questions

I have seen structure declarations which looks like this one typedef struct br {
I have seen some people in SO commenting that Singleton Pattern is an anti-pattern.
I have seen behaviour in Perforce that I am unable to explain. I took
I have seen many posting this issue in SO. I have gone through those
I have seen this talked about but never answered. Maybe it has and I'm
I have seen this question and its answers and they clear up some of
I have several classes in an application that I am currently building, and I
In a C function declaration, I have seen this parameter definition: void *userData so,
I have already seen a post about the error but This is some what
I have seen code like this: struct failed_login_res { string errorMsg<>; unsigned int error;

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.