Class StringList
- All Implemented Interfaces:
Iterable<String>,PrimitiveBeanCollection<String>
A bean defining a list of
Strings.
An example:
<datasets config-class="org.anchoranalysis.bean.primitive.StringList" config-factory="stringList">
<item>first_dataset</item>
<item>second_dataset</item>
<item>some_other_dataset</item>
</datasets>
- Author:
- Owen Feehan
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs with an empty list.StringList(String... values) Constructs, populated with one or more values.StringList(List<String> list) Constructs, populated with a list of strings. -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd an element to the collection.asList()Exposes the underlying list of values.protected booleanbooleanWhether the collection contains a particular element?Duplicate the bean.booleaninthashCode()booleanisEmpty()Whether the collection is empty or not.iterator()Methods inherited from class org.anchoranalysis.bean.AnchorBean
checkMisconfigured, describeBean, describeChildren, fields, findFieldsOfClass, getBeanName, getLocalPath, localise, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
StringList
public StringList()Constructs with an empty list. -
StringList
Constructs, populated with one or more values.- Parameters:
values- the values.
-
StringList
Constructs, populated with a list of strings.- Parameters:
list- the list.
-
-
Method Details
-
add
Description copied from interface:PrimitiveBeanCollectionAdd an element to the collection.- Specified by:
addin interfacePrimitiveBeanCollection<String>- Parameters:
value- the element to add.
-
contains
Description copied from interface:PrimitiveBeanCollectionWhether the collection contains a particular element?- Specified by:
containsin interfacePrimitiveBeanCollection<String>- Parameters:
value- the element to search for- Returns:
- true iff the collection contains the element.
-
iterator
-
isEmpty
public boolean isEmpty()Description copied from interface:PrimitiveBeanCollectionWhether the collection is empty or not.- Specified by:
isEmptyin interfacePrimitiveBeanCollection<String>- Returns:
- true iff the collection contains zero elements.
-
duplicateBean
Duplicate the bean.NOTE: We need to specifically-implement it as the
AnchorBeanfunctionality won't work with this implementation, as it uses non-default initialization (using a config-factory).- Overrides:
duplicateBeanin classAnchorBean<StringList>- Returns:
- the newly created bean
-
asList
Exposes the underlying list of values.- Returns:
- the underlying list, which if modified, also modifies this instance.
-
equals
-
canEqual
-
hashCode
public int hashCode()
-