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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T10:06:11+00:00 2026-06-15T10:06:11+00:00

Are there any situations where it’s better to use a non-generic collection in Java

  • 0

Are there any situations where it’s better to use a non-generic collection in Java rather then generic (or they still exist only for backward-compatibility)?

  • 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-15T10:06:12+00:00Added an answer on June 15, 2026 at 10:06 am

    Absolutely not. In the case in which you can’t infer types at declaration time, use a ? as a type specifier – that’s what it is for. (There are cases where using ? would restrict you from invoking certain methods, such as List.add(). In such cases, you can find a more restrictive type specifier; Object usually works).

    The non-generic usage is still supported because, technically, there is nothing wrong in not using it; you’re just going to end up writing more casting instructions and put yourself in a higher risk for ClassCastException‘s, but it is technically legitimate as far as the specification is concerned.

    Overall, there is no case (that I can think of) where avoiding generics is “better than” using them. At the worst case (when you must use ? or Object at declaration time), both approaches are equal.

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

Sidebar

Related Questions

Are there any situations when you would use assertion instead of exceptions-handling inside domain
Are there any situations where it would make more sense to use a single
Are there any situations when it worth to use realtime signals for interprocess communication(or
(See question below for more context): Are there any situations in which <machineKey validationKey=AutoGenerate,IsolateApps
Is there any way to use Google's API to retrieve a user's current zipcode
Are there any situations where using will not dispose of the object it is
Why isn't graphics acceleration turned on by default in Honeycomb? Are there any situations
Are there any situations where a dispatch table, implemented as a hash of lambdas,
What I mean is are there any situations where this: <xs:element name=MyType1> <xs:complexType> <xs:sequence>
is there any way how in this situation insert and update DB with single

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.