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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T22:18:07+00:00 2026-05-11T22:18:07+00:00

What meaning has <E> on the code Collection<E> ?

  • 0

What meaning has <E> on the code Collection<E>?

  • 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-11T22:18:07+00:00Added an answer on May 11, 2026 at 10:18 pm

    It’s the use of generics. Check this intro out. And then don’t forget to read this tutorial.

    An excerpt follows (which compares the use of a cast versus the use of generics):

    When you see the code <Type>, read it
    as “of Type”; the declaration above
    reads as “Collection of String c.” The
    code using generics is clearer and
    safer. We have eliminated an unsafe
    cast and a number of extra
    parentheses. More importantly, we have
    moved part of the specification of the
    method from a comment to its
    signature, so the compiler can verify
    at compile time that the type
    constraints are not violated at run
    time. Because the program compiles
    without warnings, we can state with
    certainty that it will not throw a
    ClassCastException at run time. The
    net effect of using generics,
    especially in large programs, is
    improved readability and robustness.

    For example, the interface of a List is

    public interface List<E> { 
        void add(E x);
        Iterator<E> iterator();
    }
    

    This means you can build a list whose contents are all of the same explicit type (not only of type Object), even if you have defined the type yourself. So, if you create a Name class you can write

    List<Name> nameList = new ArrayList<>();
    

    and then fill it with Name instances and directly retrieve Name instances from it without having to cast or otherwise worry about it because you’ll always get either a Name instance or null back, never an instance of a different type.

    More importantly, you cannot insert anything different from a Name instance in such a List, because it will fail at compile time.

    nameList.add(false); //Fails!
    nameList.add(new Name("John","Smith")); //Succeeds supposing Name has a 
                                            //firstName, lastName constructor
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 117k
  • Answers 118k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer class Program { static void Main(string[] args) { Timer timer… May 11, 2026 at 10:50 pm
  • Editorial Team
    Editorial Team added an answer Use GROUP_CONCAT SELECT GROUP_CONCAT(bar) FROM TABLE GROUP BY foo; May 11, 2026 at 10:50 pm
  • Editorial Team
    Editorial Team added an answer Your code doesn't work because the function is not returning… May 11, 2026 at 10:50 pm

Related Questions

I am attempting to allow my web designers to use the metadata we have
I'm following this tutorial which is working splendidly for has_many :through relationships. I've got
I have just started to look at .NET 3.5 so please forgive me if
Namely, how does the following code: var sup = new Array(5); sup[0] = 'z3ero';

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.