Defining collections

About this task

You can define Java collections such as Map, List and Set. And the elements in Collections can be any kind of element. It can also be the null value.
  1. Map:
    To define a Map, you can follow this sample:
    <java.util.HashMap id="aMap">
        <entry>
            <string Injection="key" value="aKey"/>
            <string Injection="value" value="aValue"/>
        </entry>
        <entry>
            <string Injection="key" value="anotherKey"/>
            <string Injection="value" value="anotherValue"/>
        </entry>
    </java.util.HashMap>
    If your key or value of the map entry is in the type of java.lang.String, you can define it as follows:
    <java.util.HashMap id="aMap">
        <entry key="aKey" value="aValue"/>
        <entry key="anotherKey" value="anotherValue"/>
    </java.util.HashMap>    
  2. List:
    To define a list, you can follow this sample:
    <java.util.ArrayList id="aList">
        <string value="str1">
        <string value="str2"/>
        <string value="str3"/>
    </java.util.ArrayList>
  3. Set:
    To define a Set, you can follow this sample:
    <java.util.HashSet id="aSet">
        <string value="str1"/>
        <string value="str2"/>
        <string value="str3"/>
    </java.util.HashSet>