public class SetUtils
extends java.lang.Object
Modifier | Constructor and Description |
---|---|
protected |
SetUtils()
Don't allow instantiation, do allow overrides.
|
Modifier and Type | Method and Description |
---|---|
static <T> void |
addAll(java.util.Set<T> set,
T[] t)
Add array entries to a set.
|
static java.util.Set<java.lang.String> |
loadIntoSet(java.util.Set<java.lang.String> set,
java.net.URL setURL,
java.lang.String encoding)
Load string set from a URL.
|
static java.util.Set<java.lang.String> |
loadSet(java.io.File setFile,
java.lang.String encoding)
Load string set from a file.
|
static java.util.Set<java.lang.String> |
loadSet(java.lang.String setFileName,
java.lang.String encoding)
Load string set from a file name.
|
static java.util.Set<java.lang.String> |
loadSet(java.net.URL setURL,
java.lang.String encoding)
Load string set from a URL.
|
static java.util.Set<java.lang.String> |
loadSortedSet(java.io.File setFile,
java.lang.String encoding)
Load sorted string set from a file.
|
static java.util.Set<java.lang.String> |
loadSortedSet(java.lang.String setFileName,
java.lang.String encoding)
Load sorted string set from a file name.
|
static java.util.Set<java.lang.String> |
loadSortedSet(java.net.URL setURL,
java.lang.String encoding)
Load sorted string set from a URL.
|
static void |
saveSet(java.util.Set<?> set,
java.io.File setFile,
java.lang.String encoding)
Save set to a file.
|
static void |
saveSet(java.util.Set<?> set,
java.lang.String setFileName,
java.lang.String encoding)
Save set as string to a file name.
|
static void |
saveSortedSet(java.util.Set<?> set,
java.io.File setFile,
java.lang.String encoding)
Save sorted set to a file.
|
static void |
saveSortedSet(java.util.Set<?> set,
java.lang.String setFileName,
java.lang.String encoding)
Save sorted set to a file name.
|
public static java.util.Set<java.lang.String> loadIntoSet(java.util.Set<java.lang.String> set, java.net.URL setURL, java.lang.String encoding) throws java.io.IOException, java.io.FileNotFoundException
set
- Set into which to read data from URL.setURL
- URL for set file.encoding
- Character encoding for the file.java.io.FileNotFoundException
- If input URL does not exist.java.io.IOException
- If input URL cannot be opened.public static java.util.Set<java.lang.String> loadSet(java.net.URL setURL, java.lang.String encoding) throws java.io.IOException, java.io.FileNotFoundException
setURL
- URL for set file.encoding
- Character encoding for the file.java.io.FileNotFoundException
- If input file does not exist.java.io.IOException
- If input file cannot be opened.public static java.util.Set<java.lang.String> loadSortedSet(java.net.URL setURL, java.lang.String encoding) throws java.io.IOException, java.io.FileNotFoundException
setURL
- URL for set file.encoding
- Character encoding for the file.java.io.FileNotFoundException
- If input file does not exist.java.io.IOException
- If input file cannot be opened.public static java.util.Set<java.lang.String> loadSet(java.io.File setFile, java.lang.String encoding) throws java.io.IOException, java.io.FileNotFoundException
setFile
- File from which to load set.encoding
- Character encoding for the file.java.io.FileNotFoundException
- If input file does not exist.java.io.IOException
- If input file cannot be opened.public static java.util.Set<java.lang.String> loadSortedSet(java.io.File setFile, java.lang.String encoding) throws java.io.IOException, java.io.FileNotFoundException
setFile
- File from which to load set.encoding
- Character encoding for the file.java.io.FileNotFoundException
- If input file does not exist.java.io.IOException
- If input file cannot be opened.public static java.util.Set<java.lang.String> loadSet(java.lang.String setFileName, java.lang.String encoding) throws java.io.IOException, java.io.FileNotFoundException
setFileName
- File name from which to load set.encoding
- Character encoding for the file.java.io.FileNotFoundException
- If input file does not exist.java.io.IOException
- If input file cannot be opened.public static java.util.Set<java.lang.String> loadSortedSet(java.lang.String setFileName, java.lang.String encoding) throws java.io.IOException, java.io.FileNotFoundException
setFileName
- File name from which to load set.encoding
- Character encoding for the file.java.io.FileNotFoundException
- If input file does not exist.java.io.IOException
- If input file cannot be opened.public static void saveSet(java.util.Set<?> set, java.io.File setFile, java.lang.String encoding) throws java.io.IOException, java.io.FileNotFoundException
set
- Set to save.setFile
- Output file name.encoding
- Character encoding for the file.java.io.IOException
- If output file has error.java.io.FileNotFoundException
public static void saveSortedSet(java.util.Set<?> set, java.io.File setFile, java.lang.String encoding) throws java.io.IOException, java.io.FileNotFoundException
set
- Set to save. The entries are sorted
in ascending order for output.setFile
- Output file name.encoding
- Character encoding for the file.java.io.IOException
- If output file has error.java.io.FileNotFoundException
public static void saveSet(java.util.Set<?> set, java.lang.String setFileName, java.lang.String encoding) throws java.io.IOException, java.io.FileNotFoundException
set
- Set to save.setFileName
- Output file name.encoding
- Character encoding for the file.java.io.IOException
- If output file has error.java.io.FileNotFoundException
public static void saveSortedSet(java.util.Set<?> set, java.lang.String setFileName, java.lang.String encoding) throws java.io.IOException, java.io.FileNotFoundException
set
- Set to save.setFileName
- Output file name.encoding
- Character encoding for the file.java.io.IOException
- If output file has error.java.io.FileNotFoundException
public static <T> void addAll(java.util.Set<T> set, T[] t) throws java.io.IOException, java.io.FileNotFoundException
set
- Set to which to add array entries.t
- Array whose entries are to be added.java.io.IOException
java.io.FileNotFoundException