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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T23:04:41+00:00 2026-06-04T23:04:41+00:00

Which advantages/disadvantages we can get by making ArrayList (or other Collection) final? I still

  • 0

Which advantages/disadvantages we can get by making ArrayList (or other Collection) final? I still can add to ArrayList new elements, remove elements and update it. But what is effect making it’s final?

  • 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-04T23:04:42+00:00Added an answer on June 4, 2026 at 11:04 pm

    But what is effect making it’s final?

    This means that you cannot rebind the variable to point to a different collection instance:

    final List<Integer> list = new ArrayList<Integer>();
    list = new ArrayList<Integer>(); // Since `list' is final, this won't compile
    

    As a matter of style, I declare most references that I don’t intend to change as final.

    I still can add to ArrayList new elements, remove elements and update it.

    If you wish, you can prevent insertion, removal etc by using Collections.unmodifiableList():

    final List<Integer> list = Collections.unmodifiableList(new ArrayList<Integer>(...));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Suppose an unauthenticated user tries to get the page which only authorized users can
Could someone tell me the advantages to using the ConfigurationManager class which load's a
Which constitutes better object oriented design? Class User { id {get;set} } Class Office
Which of the new features are you looking forward to the most in iPhone
Can any one tell me which is more stable? I know each has their
I'm new to ExpressJS. I want to create API's for my service which will
What are the advantages/disadvantages to each method? I know I've read somewhere in either
What are the advantages and disadvantages of self-hosting something like a svn repository? All
I can't think of many reasons (or any at all) in which multiple independent
I am just searching on internet about the advantages and disadvantages of various collections

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.