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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T19:15:58+00:00 2026-06-07T19:15:58+00:00

I have a Collection instruments; in my SomeClass.java and I declare in my temp.xml

  • 0

I have a Collection instruments; in my SomeClass.java and I declare in my temp.xml file a bean of the class SomeClass.java. In the xml I add two string objects to the collection.

My question is Collection is an interface so I cannot instantiate it and List is also an interface so I don’t think we can do

 Collection<String> someCollection = new List<String>();

I would like to know how the java code works when we use the list tag in the xml file. Meaning do the objects get stored in a linked list or arraylist or some type of list?

  • 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-07T19:15:59+00:00Added an answer on June 7, 2026 at 7:15 pm

    This depends on the ApplicationContext. Each implementation could be different, but you can be sure that the result is a List. Accoding documentation:

    Another custom namespace utility is for creating lists. The first bean
    definition is identical to the ListFactoryBean example except it’s a
    little shorter and easier to read. The second bean definition is the
    same except it uses the list-class attribute to specify what List
    implementation to use. When the list-class attribute isn’t used, the
    ApplicationContext will choose the implementation class.

    <util:list id="messageUtilList">
        <ref bean="stringMessage01"/>
        <ref bean="stringMessage02"/>
        <value>Spring is fun to learn.</value>
    </util:list>
    
    <util:list id="messageUtilLinkedList" 
               list-class="java.util.LinkedList">
        <ref bean="stringMessage01"/>
        <ref bean="stringMessage02"/>
        <value>Spring is fun to learn.</value>
    </util:list>
    

    Checking the implementation of ListFactoryBean you could see that ArrayList is the default list implementation that is instantiated if no specific list type is provided. The piece of code that does this task is:

    if (this.targetListClass != null) {
        result = (List) BeanUtils.instantiateClass(this.targetListClass);
    }
    else {
        result = new ArrayList(this.sourceList.size());
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have Class and Student objects. Both have collection of another as property. Which
I have collection: class HashedData : IComparable { string key; public string Key {
I have collection of documents Message in RavenDB. Definition: class Message { string Content;
I have a collection of items populated to a drop down menu: string myUserName
I have class Person: public class Person : INotifyPropertyChanged { private String name =
I have a large collection of CoreData objects which represent files. Periodically, I need
I have collection of objects. I need to sort it by difficult condition, using
I have one logical question. I have collection of employee objects There are 3
Is there a way to have collection of objects which do not have a
I have Collection List<Car> . How to compare each item from this collection with

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.