Package org.cip4.jdflib.core
Class StringArray
- All Implemented Interfaces:
Serializable,Cloneable,Iterable<String>,Collection<String>,List<String>,RandomAccess
- See Also:
-
Field Summary
Fields inherited from class java.util.AbstractList
modCount -
Constructor Summary
ConstructorsConstructorDescriptionconstructorStringArray(String strIn) convenience - constructs a VString by tokenizing a stringStringArray(String[] a) creates a VString from an array of StringsStringArray(String strIn, String strSep) constructs a VString by tokenizing a stringconstructor -
Method Summary
Modifier and TypeMethodDescriptionvoidbooleanvoidappends all strings of an array tothisvoidaddNonEmpty(String text) add a string if it is not emptyvoidappendUnique(String string) AppendUnique - append a string but ignore multiple entriesvoidAppendUnique - append a vector but ignore multiple entriesbooleancontainsAny(Collection<String> others) checks whether at least one of a given vector of strings is contained inthisget(int index) getOverlapping(Collection<String> others) vector of strings that is contained inthisgetSet()gets a set with all entries of the VString
note that the set retains ordering (LinkedHashSet)serialize to a stringserialize to a stringstatic StringArraygetVString(String strIn, String strSep) simple static factory - null if strIn is null or emptystatic booleanisEmpty(Collection<String> v) are we null or empty or contain only an empty JDFAttributeMapremove(int index) remove but also implementing the usual neg number syntaxvoidunify()unify - make VString unique, retaining initial orderMethods inherited from class java.util.ArrayList
addAll, addAll, clear, clone, contains, ensureCapacity, equals, forEach, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, removeAll, removeIf, removeRange, replaceAll, retainAll, size, sort, spliterator, subList, toArray, toArray, trimToSizeMethods inherited from class java.util.AbstractCollection
containsAll, toStringMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, stream, toArrayMethods inherited from interface java.util.List
containsAll
-
Constructor Details
-
StringArray
public StringArray()constructor -
StringArray
constructor- Parameters:
m-
-
StringArray
convenience - constructs a VString by tokenizing a string- Parameters:
strIn- the string to tokenize by blank
-
StringArray
constructs a VString by tokenizing a string- Parameters:
strIn- the string to tokenizestrSep- the list of separator characters - null if whitespace
-
StringArray
creates a VString from an array of Strings- Parameters:
a- the array
-
-
Method Details
-
set
-
add
-
add
-
isEmpty
are we null or empty or contain only an empty JDFAttributeMap- Parameters:
v-- Returns:
-
getVString
simple static factory - null if strIn is null or empty- Parameters:
strIn-strSep-- Returns:
-
get
-
appendUnique
AppendUnique - append a string but ignore multiple entries- Parameters:
string- the string to append, if null nothing is added
-
appendUnique
AppendUnique - append a vector but ignore multiple entries- Parameters:
v- the vector to append, if null nothing is added
-
getString
serialize to a string- Parameters:
sep- separator between stringsfront- string before the first entryback- string after the last entry- Returns:
- a tokenized string
-
getString
serialize to a string- Parameters:
sep- separator between stringsfront- string before the first entryback- string after the last entry- Returns:
- a tokenized string
-
unify
public void unify()unify - make VString unique, retaining initial order -
getSet
gets a set with all entries of the VString
note that the set retains ordering (LinkedHashSet)- Returns:
- the set corresponding to this
-
addAll
appends all strings of an array tothis- Parameters:
strings- the array of strings to append tothis
-
containsAny
checks whether at least one of a given vector of strings is contained inthis- Parameters:
others- the VSTring of values to test- Returns:
- true if at least one String in other is in
this
-
getOverlapping
vector of strings that is contained inthis- Parameters:
others- the VString of values to test- Returns:
- true if at least one String in other is in
this
-
remove
remove but also implementing the usual neg number syntax -
addNonEmpty
add a string if it is not empty- Parameters:
text-
-