Package fr.paris.lutece.util
Class ReferenceList
- All Implemented Interfaces:
Serializable,Cloneable,Iterable<ReferenceItem>,Collection<ReferenceItem>,List<ReferenceItem>,RandomAccess
This class provides the structure for a list of references values Each element includes a code and a name
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor.ReferenceList(int nInitialCapacity) Creates a new reference list with a specified initial capacity. -
Method Summary
Modifier and TypeMethodDescriptionvoidThis method converts the int code specified in parameter as a String and adds a new element (code, name) to the listvoidThis method adds a new element (code, name) to the listvoidcheckItems(String[] valuesToCheck) CheckItems when are selectedstatic ReferenceListconvert(Collection collection, String strCodeAttribute, String strNameAttribute, boolean bNumericCode) Converts a collection to a ReferenceListstatic ReferenceListConvert a Map<String, String> into a ReferenceListtoMap()Convert the ReferenceList into a mapMethods inherited from class java.util.ArrayList
add, add, addAll, addAll, clear, clone, contains, ensureCapacity, equals, forEach, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeIf, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray, trimToSizeMethods inherited from class java.util.AbstractCollection
containsAll, toStringMethods inherited from interface java.util.Collection
parallelStream, stream, toArrayMethods inherited from interface java.util.List
containsAll
-
Constructor Details
-
ReferenceList
public ReferenceList()Default constructor. -
ReferenceList
public ReferenceList(int nInitialCapacity) Creates a new reference list with a specified initial capacity.- Parameters:
nInitialCapacity- The initial capacity of the collection
-
-
Method Details
-
addItem
This method adds a new element (code, name) to the list- Parameters:
strCode- The code as a StringstrName- The name corresponding to the code as a String
-
addItem
This method converts the int code specified in parameter as a String and adds a new element (code, name) to the list- Parameters:
nCode- The code to convert an addstrName- The name corresponding to the code as a String
-
convert
public static ReferenceList convert(Collection collection, String strCodeAttribute, String strNameAttribute, boolean bNumericCode) Converts a collection to a ReferenceList- Parameters:
collection- The collection to convertstrCodeAttribute- The name of the code attribute. Ex : "id" to call getId()strNameAttribute- The name of the code attribute. Ex : "name" to call getName()bNumericCode- true if the code getter returns an Integer, false otherwise- Returns:
- The ReferenceList filled
- Since:
- v1.1
-
convert
Convert a Map<String, String> into a ReferenceList- Parameters:
map- the map to convert- Returns:
- the converted ReferenceList
-
toMap
Convert the ReferenceList into a map- Returns:
- the converted map
-
checkItems
CheckItems when are selected- Parameters:
valuesToCheck- The list of string
-