public class StringTokenSet extends Object implements Set<String>
StringTokenSet implement Set based on a list of String tokens separated by SEPARATOR.
Examples:
"foo,bar" contains "foo" and "bar"",,x,,y" contains three empty string and "x", "y"This data structure is better to be used in case the string token set are unlikely to change and the number of string tokens are not very big (no bigger than 20)
This data structure is not thread safe
| Modifier and Type | Field and Description |
|---|---|
static String |
SEPARATOR
The default separator:
, |
static char |
SEPARATOR_CHAR |
| Constructor and Description |
|---|
StringTokenSet() |
StringTokenSet(String data)
Construct a
StringTokenSet with given string |
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(String s) |
boolean |
addAll(Collection<? extends String> c) |
void |
clear() |
boolean |
contains(Object o) |
boolean |
containsAll(Collection<?> c) |
boolean |
equals(Object obj) |
int |
hashCode() |
boolean |
isEmpty() |
Iterator<String> |
iterator() |
static String |
merge(Collection<String> sa) |
static String |
merge(String[] sa) |
static String |
merge(String a,
String... others) |
static String |
merge(String a,
String b) |
static StringTokenSet |
of(String data) |
boolean |
remove(Object o) |
boolean |
removeAll(Collection<?> c) |
boolean |
retainAll(Collection<?> c) |
int |
size() |
StringTokenSet |
sort() |
Object[] |
toArray() |
<T> T[] |
toArray(T[] a) |
String |
toString() |
clone, finalize, getClass, notify, notifyAll, wait, wait, waitspliteratorparallelStream, removeIf, streampublic static final String SEPARATOR
The default separator: ,
public static final char SEPARATOR_CHAR
public int size()
public boolean isEmpty()
public boolean contains(Object o)
public Object[] toArray()
public <T> T[] toArray(T[] a)
public boolean add(String s)
public boolean remove(Object o)
public boolean containsAll(Collection<?> c)
containsAll in interface Collection<String>containsAll in interface Set<String>public boolean addAll(Collection<? extends String> c)
public boolean retainAll(Collection<?> c)
public boolean removeAll(Collection<?> c)
public void clear()
public int hashCode()
public boolean equals(Object obj)
public StringTokenSet sort()
public static StringTokenSet of(String data)
public static String merge(Collection<String> sa)
Copyright © 2014–2019 OSGL (Open Source General Library). All rights reserved.