Package com.github.tommyettinger.ds
Class FilteredStringOrderedSet
java.lang.Object
com.github.tommyettinger.ds.ObjectSet<T>
com.github.tommyettinger.ds.ObjectOrderedSet<String>
com.github.tommyettinger.ds.FilteredStringOrderedSet
- All Implemented Interfaces:
Arrangeable,EnhancedCollection<String>,Ordered<String>,Iterable<String>,Collection<String>,Set<String>
A customizable variant on ObjectOrderedSet that always uses String keys, but only considers any character in an item
(for equality and hashing purposes) if that character satisfies a predicate. This can also edit the characters that
pass the filter, such as by changing their case during comparisons (and hashing). You will usually want to call
You can use this class as a replacement for
Be advised that if you use some (most) checks in
This is very similar to
setFilter(CharFilter) to change the behavior of hashing and equality before you enter any items, unless you
have specified the CharFilter you want in the constructor.
You can use this class as a replacement for
CaseInsensitiveOrderedSet if you set the editor to a method
reference to Character.toUpperCase(char) or Casing.caseUp(char). You can go further by setting the
filter to make the hashing and equality checks ignore characters that don't satisfy a predicate, such as
Character.isLetter(char). CaseInsensitiveOrderedSet does allow taking arbitrary CharSequence types as keys,
but it doesn't permit modifying them, so usually Strings are a good choice anyway.
Be advised that if you use some (most) checks in
Character for properties of a char, and you try to use them
on GWT, those checks will not work as expected for non-ASCII characters. Some other platforms might also be affected,
such as TeaVM, but it isn't clear yet which platforms have full Unicode support. You can consider depending upon
RegExodus for more cross-platform Unicode support; a method
reference to Category.L::contains acts like Character::isLetter, but works on GWT.
com.github.tommyettinger.ds.support.util.CharPredicates provides a few common CharPredicate constants that
will work identically on all platforms.
This is very similar to
FilteredStringSet,
except that this class maintains insertion order and can be sorted with ObjectOrderedSet.sort(), ObjectOrderedSet.sort(Comparator), etc.
Note that because each String is stored in here in its original form (not modified to make it use the filter and editor),
the sorted order might be different than you expect.
You can use FilteredComparators.makeStringComparator(CharPredicate, CharToCharFunction) to create a Comparator
for Strings that uses the same rules this class does.-
Nested Class Summary
Nested classes/interfaces inherited from class com.github.tommyettinger.ds.ObjectOrderedSet
ObjectOrderedSet.ObjectOrderedSetIterator<K>Nested classes/interfaces inherited from class com.github.tommyettinger.ds.ObjectSet
ObjectSet.ObjectSetIterator<T>Nested classes/interfaces inherited from interface com.github.tommyettinger.ds.Arrangeable
Arrangeable.ArrangeableList<T>Nested classes/interfaces inherited from interface com.github.tommyettinger.ds.Ordered
Ordered.OfBoolean, Ordered.OfByte, Ordered.OfChar, Ordered.OfDouble, Ordered.OfFloat, Ordered.OfInt, Ordered.OfLong, Ordered.OfShort -
Field Summary
FieldsFields inherited from class com.github.tommyettinger.ds.ObjectOrderedSet
itemsFields inherited from class com.github.tommyettinger.ds.ObjectSet
hashMultiplier, iterator1, iterator2, keyTable, loadFactor, mask, shift, size, threshold -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new set with an initial capacity ofUtilities.getDefaultTableCapacity()and a load factor ofUtilities.getDefaultLoadFactor().FilteredStringOrderedSet(int initialCapacity) Creates a new set with the specified initial capacity a load factor ofUtilities.getDefaultLoadFactor().FilteredStringOrderedSet(int initialCapacity, float loadFactor) Creates a new set with the specified initial capacity and load factor.FilteredStringOrderedSet(int initialCapacity, float loadFactor, OrderType type) Creates a new set with the specified initial capacity and load factor.FilteredStringOrderedSet(int initialCapacity, OrderType type) Creates a new set with the specified initial capacity a load factor ofUtilities.getDefaultLoadFactor().FilteredStringOrderedSet(CharFilter filter) Creates a new set with an initial capacity ofUtilities.getDefaultTableCapacity()and a load factor ofUtilities.getDefaultLoadFactor().FilteredStringOrderedSet(CharFilter filter, int initialCapacity) Creates a new set with the specified initial capacity and the default load factor.FilteredStringOrderedSet(CharFilter filter, int initialCapacity, float loadFactor) Creates a new set with the specified initial capacity and load factor.FilteredStringOrderedSet(CharFilter filter, int initialCapacity, float loadFactor, OrderType type) Creates a new set with the specified initial capacity and load factor.FilteredStringOrderedSet(CharFilter filter, int initialCapacity, OrderType type) Creates a new set with the specified initial capacity and the default load factor.FilteredStringOrderedSet(CharFilter filter, Ordered<String> ordered, int offset, int count) Creates a new set usingcountitems from the givenordered, starting at offset (inclusive).FilteredStringOrderedSet(CharFilter filter, Ordered<String> ordered, int offset, int count, OrderType type) Creates a new set usingcountitems from the givenordered, starting at offset (inclusive).FilteredStringOrderedSet(CharFilter filter, OrderType type) Creates a new set with an initial capacity ofUtilities.getDefaultTableCapacity()and a load factor ofUtilities.getDefaultLoadFactor().FilteredStringOrderedSet(CharFilter filter, String[] array) Creates a new set containing all the items in the given array.FilteredStringOrderedSet(CharFilter filter, String[] array, int offset, int length) Creates a new set usinglengthitems from the givenarray, starting at offset (inclusive).FilteredStringOrderedSet(CharFilter filter, String[] array, int offset, int length, OrderType type) Creates a new set usinglengthitems from the givenarray, starting at offset (inclusive).FilteredStringOrderedSet(CharFilter filter, String[] array, OrderType type) Creates a new set containing all the items in the given array.FilteredStringOrderedSet(CharFilter filter, Collection<? extends String> coll) Creates a new set that contains all distinct elements incoll.FilteredStringOrderedSet(CharFilter filter, Collection<? extends String> coll, OrderType type) Creates a new set that contains all distinct elements incoll.Creates a new set identical to the specified set.Creates a new set identical to the specified set.Creates a new set with an initial capacity ofUtilities.getDefaultTableCapacity()and a load factor ofUtilities.getDefaultLoadFactor(). -
Method Summary
Modifier and TypeMethodDescriptionbooleanCompares two objects for equality by the rules this filtered data structure uses for keys.inthashCode()protected inthashHelper(String s) Gets a low-to-moderate quality 32-bit hash code from the given String.static FilteredStringOrderedSetparse(CharFilter filter, String str, String delimiter) CallsObjectOrderedSet.parse(String, String, PartialParser, boolean)with brackets set to false.static FilteredStringOrderedSetparse(CharFilter filter, String str, String delimiter, boolean brackets) Creates a new FilteredStringOrderedSet usingfilterand fills it by callingEnhancedCollection.addLegible(String, String, PartialParser, int, int)on either all ofstr(ifbracketsis false) orstrwithout its first and last chars (ifbracketsis true).static FilteredStringOrderedSetparse(CharFilter filter, String str, String delimiter, int offset, int length) Creates a new FilteredStringOrderedSet usingfilterand fills it by callingEnhancedCollection.addLegible(String, String, PartialParser, int, int), usingPartialParser.DEFAULT_STRINGand with the other four parameters as-is.protected intReturns an index >= 0 and <=ObjectSet.maskfor the specifieditem, mixed.setFilter(CharFilter filter) Sets the CharFilter that determines which characters in a String are considered for equality and hashing, as well as any changes made to characters before hashing or equating, then returns this object, for chaining.static FilteredStringOrderedSetwith(CharFilter filter) Constructs an empty set given a CharFilter.static FilteredStringOrderedSetwith(CharFilter filter, String item) Creates a new FilteredStringOrderedSet that holds only the given item, but can be resized.static FilteredStringOrderedSetwith(CharFilter filter, String... varargs) Creates a new FilteredStringOrderedSet that holds only the given items, but can be resized.static FilteredStringOrderedSetwith(CharFilter filter, String item0, String item1) Creates a new FilteredStringOrderedSet that holds only the given items, but can be resized.static FilteredStringOrderedSetwith(CharFilter filter, String item0, String item1, String item2) Creates a new FilteredStringOrderedSet that holds only the given items, but can be resized.static FilteredStringOrderedSetCreates a new FilteredStringOrderedSet that holds only the given items, but can be resized.static FilteredStringOrderedSetCreates a new FilteredStringOrderedSet that holds only the given items, but can be resized.static FilteredStringOrderedSetwith(CharFilter filter, String item0, String item1, String item2, String item3, String item4, String item5) Creates a new FilteredStringOrderedSet that holds only the given items, but can be resized.static FilteredStringOrderedSetwith(CharFilter filter, String item0, String item1, String item2, String item3, String item4, String item5, String item6) Creates a new FilteredStringOrderedSet that holds only the given items, but can be resized.static FilteredStringOrderedSetwith(CharFilter filter, String item0, String item1, String item2, String item3, String item4, String item5, String item6, String item7) Creates a new FilteredStringOrderedSet that holds only the given items, but can be resized.Methods inherited from class com.github.tommyettinger.ds.ObjectOrderedSet
add, add, addAll, addAll, alter, alterAt, clear, clear, ensureCapacity, first, getAt, iterator, order, parse, parse, parse, remove, removeAt, removeRange, sort, sort, toString, toString, truncate, with, with, with, with, with, with, with, with, with, withMethods inherited from class com.github.tommyettinger.ds.ObjectSet
addAll, addAll, addAll, addAll, addResize, appendTo, contains, containsAll, containsAll, containsAll, containsAny, containsAny, containsAnyIterable, equals, get, getHashMultiplier, getLoadFactor, getTableSize, isEmpty, locateKey, notEmpty, removeAll, removeAll, removeAll, resize, retainAll, setHashMultiplier, setLoadFactor, shrink, size, toArray, toArrayMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface com.github.tommyettinger.ds.Arrangeable
rearrange, shuffle, sizeMethods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArrayMethods inherited from interface com.github.tommyettinger.ds.EnhancedCollection
add, add, add, addAll, addAllIterable, addLegible, addLegible, addVarargs, appendTo, appendTo, containsAll, containsAllIterable, containsAny, removeAll, removeAllIterable, removeEach, removeEach, removeEach, removeEachIterable, toString, toStringMethods inherited from interface com.github.tommyettinger.ds.Ordered
getOrderType, random, random, reverse, selectRanked, selectRankedIndex, shuffle, swapMethods inherited from interface java.util.Set
spliterator
-
Field Details
-
filter
-
-
Constructor Details
-
FilteredStringOrderedSet
Creates a new set with an initial capacity ofUtilities.getDefaultTableCapacity()and a load factor ofUtilities.getDefaultLoadFactor(). This considers all characters in a String key and does not edit them.- Parameters:
type- eitherOrderType.BAGto use unreliable ordering with faster deletion, or anything else to use a list type that takes longer to delete but maintains insertion order reliably
-
FilteredStringOrderedSet
Creates a new set with the specified initial capacity a load factor ofUtilities.getDefaultLoadFactor(). This set will hold initialCapacity items before growing the backing table. This considers all characters in a String key and does not edit them.- Parameters:
initialCapacity- If not a power of two, it is increased to the next nearest power of two.type- eitherOrderType.BAGto use unreliable ordering with faster deletion, or anything else to use a list type that takes longer to delete but maintains insertion order reliably
-
FilteredStringOrderedSet
Creates a new set with the specified initial capacity and load factor. This set will hold initialCapacity items before growing the backing table. This considers all characters in a String key and does not edit them.- Parameters:
initialCapacity- If not a power of two, it is increased to the next nearest power of two.loadFactor- what fraction of the capacity can be filled before this has to resize; 0 < loadFactor <= 1type- eitherOrderType.BAGto use unreliable ordering with faster deletion, or anything else to use a list type that takes longer to delete but maintains insertion order reliably
-
FilteredStringOrderedSet
Creates a new set with an initial capacity ofUtilities.getDefaultTableCapacity()and a load factor ofUtilities.getDefaultLoadFactor(). This uses the specified CharFilter.- Parameters:
filter- a CharFilter that can be obtained withCharFilter.getOrCreate(String, CharPredicate, CharToCharFunction)type- eitherOrderType.BAGto use unreliable ordering with faster deletion, or anything else to use a list type that takes longer to delete but maintains insertion order reliably
-
FilteredStringOrderedSet
Creates a new set with the specified initial capacity and the default load factor. This set will hold initialCapacity items before growing the backing table. This uses the specified CharFilter.- Parameters:
filter- a CharFilter that can be obtained withCharFilter.getOrCreate(String, CharPredicate, CharToCharFunction)initialCapacity- If not a power of two, it is increased to the next nearest power of two.type- eitherOrderType.BAGto use unreliable ordering with faster deletion, or anything else to use a list type that takes longer to delete but maintains insertion order reliably
-
FilteredStringOrderedSet
public FilteredStringOrderedSet(CharFilter filter, int initialCapacity, float loadFactor, OrderType type) Creates a new set with the specified initial capacity and load factor. This set will hold initialCapacity items before growing the backing table. This uses the specified CharFilter.- Parameters:
filter- a CharFilter that can be obtained withCharFilter.getOrCreate(String, CharPredicate, CharToCharFunction)initialCapacity- If not a power of two, it is increased to the next nearest power of two.loadFactor- what fraction of the capacity can be filled before this has to resize; 0 < loadFactor <= 1type- eitherOrderType.BAGto use unreliable ordering with faster deletion, or anything else to use a list type that takes longer to delete but maintains insertion order reliably
-
FilteredStringOrderedSet
Creates a new set identical to the specified set.- Parameters:
set- another FilteredStringOrderedSet to copytype- eitherOrderType.BAGto use unreliable ordering with faster deletion, or anything else to use a list type that takes longer to delete but maintains insertion order reliably
-
FilteredStringOrderedSet
public FilteredStringOrderedSet(CharFilter filter, Collection<? extends String> coll, OrderType type) Creates a new set that contains all distinct elements incoll. This uses the specified CharFilter, including while it enters the items in coll.- Parameters:
filter- a CharFilter that can be obtained withCharFilter.getOrCreate(String, CharPredicate, CharToCharFunction)coll- a Collection implementation to copy, such as an ObjectList or a Set that isn't a FilteredStringOrderedSettype- eitherOrderType.BAGto use unreliable ordering with faster deletion, or anything else to use a list type that takes longer to delete but maintains insertion order reliably
-
FilteredStringOrderedSet
public FilteredStringOrderedSet(CharFilter filter, String[] array, int offset, int length, OrderType type) Creates a new set usinglengthitems from the givenarray, starting at offset (inclusive). This uses the specified CharFilter, including while it enters the items in array.- Parameters:
filter- a CharFilter that can be obtained withCharFilter.getOrCreate(String, CharPredicate, CharToCharFunction)array- an array to draw items fromoffset- the first index in array to draw an item fromlength- how many items to take from array; bounds-checking is the responsibility of the using codetype- eitherOrderType.BAGto use unreliable ordering with faster deletion, or anything else to use a list type that takes longer to delete but maintains insertion order reliably
-
FilteredStringOrderedSet
Creates a new set containing all the items in the given array. This uses the specified CharFilter, including while it enters the items in array.- Parameters:
filter- a CharFilter that can be obtained withCharFilter.getOrCreate(String, CharPredicate, CharToCharFunction)array- an array that will be used in full, except for duplicate itemstype- eitherOrderType.BAGto use unreliable ordering with faster deletion, or anything else to use a list type that takes longer to delete but maintains insertion order reliably
-
FilteredStringOrderedSet
public FilteredStringOrderedSet(CharFilter filter, Ordered<String> ordered, int offset, int count, OrderType type) Creates a new set usingcountitems from the givenordered, starting at offset (inclusive). This uses the specified CharFilter, including while it enters the items in ordered.- Parameters:
filter- a CharFilter that can be obtained withCharFilter.getOrCreate(String, CharPredicate, CharToCharFunction)ordered- an ordered to draw items fromoffset- the first index in ordered to draw an item fromcount- how many items to take from ordered; bounds-checking is the responsibility of the using codetype- eitherOrderType.BAGto use unreliable ordering with faster deletion, or anything else to use a list type that takes longer to delete but maintains insertion order reliably
-
FilteredStringOrderedSet
public FilteredStringOrderedSet()Creates a new set with an initial capacity ofUtilities.getDefaultTableCapacity()and a load factor ofUtilities.getDefaultLoadFactor(). This considers all characters in a String key and does not edit them. -
FilteredStringOrderedSet
public FilteredStringOrderedSet(int initialCapacity) Creates a new set with the specified initial capacity a load factor ofUtilities.getDefaultLoadFactor(). This set will hold initialCapacity items before growing the backing table. This considers all characters in a String key and does not edit them.- Parameters:
initialCapacity- If not a power of two, it is increased to the next nearest power of two.
-
FilteredStringOrderedSet
public FilteredStringOrderedSet(int initialCapacity, float loadFactor) Creates a new set with the specified initial capacity and load factor. This set will hold initialCapacity items before growing the backing table. This considers all characters in a String key and does not edit them.- Parameters:
initialCapacity- If not a power of two, it is increased to the next nearest power of two.loadFactor- what fraction of the capacity can be filled before this has to resize; 0 < loadFactor <= 1
-
FilteredStringOrderedSet
Creates a new set with an initial capacity ofUtilities.getDefaultTableCapacity()and a load factor ofUtilities.getDefaultLoadFactor(). This uses the specified CharFilter.- Parameters:
filter- a CharFilter that can be obtained withCharFilter.getOrCreate(String, CharPredicate, CharToCharFunction)
-
FilteredStringOrderedSet
Creates a new set with the specified initial capacity and the default load factor. This set will hold initialCapacity items before growing the backing table. This uses the specified CharFilter.- Parameters:
filter- a CharFilter that can be obtained withCharFilter.getOrCreate(String, CharPredicate, CharToCharFunction)initialCapacity- If not a power of two, it is increased to the next nearest power of two.
-
FilteredStringOrderedSet
Creates a new set with the specified initial capacity and load factor. This set will hold initialCapacity items before growing the backing table. This uses the specified CharFilter.- Parameters:
filter- a CharFilter that can be obtained withCharFilter.getOrCreate(String, CharPredicate, CharToCharFunction)initialCapacity- If not a power of two, it is increased to the next nearest power of two.loadFactor- what fraction of the capacity can be filled before this has to resize; 0 < loadFactor <= 1
-
FilteredStringOrderedSet
Creates a new set identical to the specified set.- Parameters:
set- another FilteredStringOrderedSet to copy
-
FilteredStringOrderedSet
Creates a new set that contains all distinct elements incoll. This uses the specified CharFilter, including while it enters the items in coll.- Parameters:
filter- a CharFilter that can be obtained withCharFilter.getOrCreate(String, CharPredicate, CharToCharFunction)coll- a Collection implementation to copy, such as an ObjectList or a Set that isn't a FilteredStringOrderedSet
-
FilteredStringOrderedSet
Creates a new set usinglengthitems from the givenarray, starting at offset (inclusive). This uses the specified CharFilter, including while it enters the items in array.- Parameters:
filter- a CharFilter that can be obtained withCharFilter.getOrCreate(String, CharPredicate, CharToCharFunction)array- an array to draw items fromoffset- the first index in array to draw an item fromlength- how many items to take from array; bounds-checking is the responsibility of the using code
-
FilteredStringOrderedSet
Creates a new set containing all the items in the given array. This uses the specified CharFilter, including while it enters the items in array.- Parameters:
filter- a CharFilter that can be obtained withCharFilter.getOrCreate(String, CharPredicate, CharToCharFunction)array- an array that will be used in full, except for duplicate items
-
FilteredStringOrderedSet
Creates a new set usingcountitems from the givenordered, starting at offset (inclusive). This uses the specified CharFilter, including while it enters the items in ordered.- Parameters:
filter- a CharFilter that can be obtained withCharFilter.getOrCreate(String, CharPredicate, CharToCharFunction)ordered- an ordered to draw items fromoffset- the first index in ordered to draw an item fromcount- how many items to take from ordered; bounds-checking is the responsibility of the using code
-
-
Method Details
-
getFilter
-
setFilter
Sets the CharFilter that determines which characters in a String are considered for equality and hashing, as well as any changes made to characters before hashing or equating, then returns this object, for chaining. If the filter changes, that invalidates anything previously entered into this, so before changing the filter this clears the entire data structure, removing all existing items.- Parameters:
filter- a CharFilter that can be obtained withCharFilter.getOrCreate(String, CharPredicate, CharToCharFunction)- Returns:
- this, for chaining
-
hashHelper
Gets a low-to-moderate quality 32-bit hash code from the given String. This operates by checking if a char insmatches the filter, and if it does, it rotates the current hash, multiplies it by thehash multiplier, and XORs with the current char after editing. This finalizes the hash by multiplying it again by the hash multiplier, then using the reversible XOR-rotate-XOR-rotate sequence of operations to adequately jumble the bits.- Parameters:
s- a String to hash- Returns:
- a 32-bit hash of
s
-
place
Description copied from class:ObjectSetReturns an index >= 0 and <=ObjectSet.maskfor the specifieditem, mixed.- Overrides:
placein classObjectSet<String>- Parameters:
item- a non-null Object; its hashCode() method should be used by most implementations- Returns:
- an index between 0 and
ObjectSet.mask(both inclusive)
-
equate
Compares two objects for equality by the rules this filtered data structure uses for keys. This will return true if the arguments are reference-equivalent or both null. Otherwise, it requires that both areStrings and compares them using thefilterof this object.- Overrides:
equatein classObjectSet<String>- Parameters:
left- must be non-null; typically a key being compared, but not necessarilyright- may be null; typically a key being compared, but can often be null for an empty key slot, or some other type- Returns:
- true if left and right are equivalent according to the rules this filtered type uses
-
hashCode
public int hashCode()- Specified by:
hashCodein interfaceCollection<String>- Specified by:
hashCodein interfaceSet<String>- Overrides:
hashCodein classObjectOrderedSet<String>
-
with
Constructs an empty set given a CharFilter. This is usually less useful than just using the constructor, but can be handy in some code-generation scenarios when you don't know how many arguments you will have.- Parameters:
filter- a CharFilter that can be obtained withCharFilter.getOrCreate(String, CharPredicate, CharToCharFunction)- Returns:
- a new set containing nothing
-
with
Creates a new FilteredStringOrderedSet that holds only the given item, but can be resized.- Parameters:
filter- a CharFilter that can be obtained withCharFilter.getOrCreate(String, CharPredicate, CharToCharFunction)item- one String item- Returns:
- a new FilteredStringOrderedSet that holds the given item
-
with
Creates a new FilteredStringOrderedSet that holds only the given items, but can be resized.- Parameters:
filter- a CharFilter that can be obtained withCharFilter.getOrCreate(String, CharPredicate, CharToCharFunction)item0- a String itemitem1- a String item- Returns:
- a new FilteredStringOrderedSet that holds the given items
-
with
public static FilteredStringOrderedSet with(CharFilter filter, String item0, String item1, String item2) Creates a new FilteredStringOrderedSet that holds only the given items, but can be resized.- Parameters:
filter- a CharFilter that can be obtained withCharFilter.getOrCreate(String, CharPredicate, CharToCharFunction)item0- a String itemitem1- a String itemitem2- a String item- Returns:
- a new FilteredStringOrderedSet that holds the given items
-
with
public static FilteredStringOrderedSet with(CharFilter filter, String item0, String item1, String item2, String item3) Creates a new FilteredStringOrderedSet that holds only the given items, but can be resized.- Parameters:
filter- a CharFilter that can be obtained withCharFilter.getOrCreate(String, CharPredicate, CharToCharFunction)item0- a String itemitem1- a String itemitem2- a String itemitem3- a String item- Returns:
- a new FilteredStringOrderedSet that holds the given items
-
with
public static FilteredStringOrderedSet with(CharFilter filter, String item0, String item1, String item2, String item3, String item4) Creates a new FilteredStringOrderedSet that holds only the given items, but can be resized.- Parameters:
filter- a CharFilter that can be obtained withCharFilter.getOrCreate(String, CharPredicate, CharToCharFunction)item0- a String itemitem1- a String itemitem2- a String itemitem3- a String itemitem4- a String item- Returns:
- a new FilteredStringOrderedSet that holds the given items
-
with
public static FilteredStringOrderedSet with(CharFilter filter, String item0, String item1, String item2, String item3, String item4, String item5) Creates a new FilteredStringOrderedSet that holds only the given items, but can be resized.- Parameters:
filter- a CharFilter that can be obtained withCharFilter.getOrCreate(String, CharPredicate, CharToCharFunction)item0- a String itemitem1- a String itemitem2- a String itemitem3- a String itemitem4- a String itemitem5- a String item- Returns:
- a new FilteredStringOrderedSet that holds the given items
-
with
public static FilteredStringOrderedSet with(CharFilter filter, String item0, String item1, String item2, String item3, String item4, String item5, String item6) Creates a new FilteredStringOrderedSet that holds only the given items, but can be resized.- Parameters:
filter- a CharFilter that can be obtained withCharFilter.getOrCreate(String, CharPredicate, CharToCharFunction)item0- a String itemitem1- a String itemitem2- a String itemitem3- a String itemitem4- a String itemitem5- a String itemitem6- a String item- Returns:
- a new FilteredStringOrderedSet that holds the given items
-
with
public static FilteredStringOrderedSet with(CharFilter filter, String item0, String item1, String item2, String item3, String item4, String item5, String item6, String item7) Creates a new FilteredStringOrderedSet that holds only the given items, but can be resized.- Parameters:
filter- a CharFilter that can be obtained withCharFilter.getOrCreate(String, CharPredicate, CharToCharFunction)item0- a String itemitem1- a String itemitem2- a String itemitem3- a String itemitem4- a String itemitem5- a String itemitem6- a String item- Returns:
- a new FilteredStringOrderedSet that holds the given items
-
with
Creates a new FilteredStringOrderedSet that holds only the given items, but can be resized. This overload will only be used when an array is supplied or if varargs are used and there are 9 or more arguments.- Parameters:
filter- a CharFilter that can be obtained withCharFilter.getOrCreate(String, CharPredicate, CharToCharFunction)varargs- a String varargs or String array; remember that varargs allocate- Returns:
- a new FilteredStringOrderedSet that holds the given items
-
parse
CallsObjectOrderedSet.parse(String, String, PartialParser, boolean)with brackets set to false.- Parameters:
filter- a CharFilter that can be obtained withCharFilter.getOrCreate(String, CharPredicate, CharToCharFunction)str- a String that will be parsed in fulldelimiter- the delimiter between items in str- Returns:
- a new collection parsed from str
-
parse
public static FilteredStringOrderedSet parse(CharFilter filter, String str, String delimiter, boolean brackets) Creates a new FilteredStringOrderedSet usingfilterand fills it by callingEnhancedCollection.addLegible(String, String, PartialParser, int, int)on either all ofstr(ifbracketsis false) orstrwithout its first and last chars (ifbracketsis true). Each item is expected to be separated bydelimiter.- Parameters:
filter- a CharFilter that can be obtained withCharFilter.getOrCreate(String, CharPredicate, CharToCharFunction)str- a String that will be parsed in full (depending on brackets)delimiter- the delimiter between items in strbrackets- if true, the first and last chars in str will be ignored- Returns:
- a new collection parsed from str
-
parse
public static FilteredStringOrderedSet parse(CharFilter filter, String str, String delimiter, int offset, int length) Creates a new FilteredStringOrderedSet usingfilterand fills it by callingEnhancedCollection.addLegible(String, String, PartialParser, int, int), usingPartialParser.DEFAULT_STRINGand with the other four parameters as-is.- Parameters:
filter- a CharFilter that can be obtained withCharFilter.getOrCreate(String, CharPredicate, CharToCharFunction)str- a String that will have the given section parseddelimiter- the delimiter between items in stroffset- the first position to parse in str, inclusivelength- how many chars to parse, starting from offset- Returns:
- a new collection parsed from str
-