public final class Utils
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
private static class |
Utils.ContextContainer
Simple container that stores and returns a context-local instance of
the global work area.
|
private static class |
Utils.DirectoryHelper
Provides a simple unified API for delegating the querying of a
data type-specific value from the directory.
|
static class |
Utils.DirScope
Define search modes for the directory node lookups.
|
static class |
Utils.InstrumentedMap<K,V>
Utility class extending HashMap functionality
|
private static class |
Utils.WorkArea
Stores global data relating to the state of the current context.
|
Modifier and Type | Field and Description |
---|---|
private static boolean |
init
Tracks if the static data has been initialized.
|
private static java.util.logging.Logger |
LOG
logger
|
private static java.lang.String |
override
Charset name to use for encoding or
null for default. |
private static java.lang.Object |
token
Logging token that ensures unimplemented feature logging occurs only once.
|
private static Utils.ContextContainer |
work
Stores context-local state variables.
|
Modifier | Constructor and Description |
---|---|
private |
Utils()
Private constructor to prevent instances of this class from being
created.
|
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
canonicalizePath(java.lang.String path,
java.lang.String oldSeparator,
java.lang.String newSeparator)
Canonicalize the given file system path as described by
java.io.File.getCanonicalPath() . |
static boolean |
causeChainContains(java.lang.Throwable thr,
java.lang.Class[] criteria)
Determine if the given throwable or one of its causes matches one of the throwable
types given as criteria.
|
static boolean |
copyFile(java.lang.String source,
java.lang.String target,
int bsize,
boolean append)
Handles the byte for byte copying of a single source file to a target
file, using a buffer size of the caller's choice.
|
static boolean |
copyFileIfNeeded(java.lang.String source,
java.lang.String target,
int bsize)
Conditionally copies a file, byte for byte (no changes) to a new file,
if and only if the source is an accessible file and the target doesn't
exist or the target exists as a file but is older than the source or
has a different size.
|
static boolean |
createPathForTarget(java.lang.String tar)
Creates all subdirectories needed to provide a valid path for the
target filename that is passed in.
|
static java.lang.String |
describeContext()
Get a string which uniquely describes the current context.
|
static <T> void |
difference(java.util.Set<T> a,
java.util.Set<T> b,
java.util.Set<T> result)
Produces the difference of two sets and puts it into the third set.
|
static int[] |
diffIntArrays(int[] a,
int[] b)
Produces the difference of two int arrays.
|
static <T> boolean |
equals(T obj1,
T obj2)
Generic type safe equals.
|
private static java.lang.Object |
executeLookup(DirectoryService ds,
java.lang.String root,
java.lang.String postfix,
java.lang.String nodeId,
java.lang.String expected,
Utils.DirectoryHelper helper)
Builds the node path from its parts, checks that it exists with the
correct data type and if so, returns the value.
|
static java.lang.String |
findDirectoryNodePath(DirectoryService ds,
java.lang.String nodeId,
java.lang.String expected,
boolean scope)
Obtain the path to the node in the directory if it exists or return
null if the directory node doesn't exist with the proper
type, the directory paths don't exist or the directory is unavailable. |
static java.lang.String |
findDirectoryNodePath(DirectoryService ds,
java.lang.String nodeId,
java.lang.String expected,
Utils.DirScope scope,
java.lang.String[] accountIds)
Obtain the path to the node in the directory if it exists or return
null if the directory node doesn't exist with the proper
type, the directory paths don't exist or the directory is unavailable. |
static java.io.File |
findFileInPath(java.lang.String filename,
java.lang.String[] paths)
Find the specified file in the file system using the specified search
paths and return it.
|
static java.util.List<java.io.File> |
getCaseInsensitiveFilenameMatches(java.lang.String path)
Supply a list of files which case-insensitively match the given file
name.
|
static java.util.List<java.io.File> |
getCaseInsensitiveFilenameMatches(java.lang.String path,
java.lang.String separator)
Supply a list of files which case-insensitively match the given file
name.
|
static java.lang.String |
getCharsetName()
Reports the default character set name.
|
static java.lang.String |
getCharsetOverride()
Reports if the default character set needs to be replaced.
|
static boolean |
getDirectoryNodeBoolean(DirectoryService ds,
java.lang.String nodeId,
boolean initial)
Obtain the specified attribute from the directory if it exists or return
the default value if the directory node doesn't exist with the proper
type, the directory paths don't exist or the directory is unavailable.
|
static boolean |
getDirectoryNodeBoolean(DirectoryService ds,
java.lang.String nodeId,
boolean initial,
boolean scope)
Obtain the specified attribute from the directory if it exists or return
the default value if the directory node doesn't exist with the proper
type, the directory paths don't exist or the directory is unavailable.
|
static boolean |
getDirectoryNodeBoolean(DirectoryService ds,
java.lang.String nodeId,
boolean initial,
Utils.DirScope scope,
java.lang.String[] accountIds)
Obtain the specified attribute from the directory if it exists or return
the default value if the directory node doesn't exist with the proper
type, the directory paths don't exist or the directory is unavailable.
|
static byte[] |
getDirectoryNodeByteArray(DirectoryService ds,
java.lang.String nodeId,
byte[] initial,
Utils.DirScope scope,
java.lang.String[] accountIds)
Obtain the specified attribute from the directory if it exists or return
the default value if the directory node doesn't exist with the proper
type, the directory paths don't exist or the directory is unavailable.
|
static char |
getDirectoryNodeChar(DirectoryService ds,
java.lang.String nodeId,
char initial)
Obtain the specified attribute from the directory if it exists or return
the default value if the directory node doesn't exist with the proper
type, the directory paths don't exist or the directory is unavailable.
|
static char |
getDirectoryNodeChar(DirectoryService ds,
java.lang.String nodeId,
char initial,
boolean scope)
Obtain the specified attribute from the directory if it exists or return
the default value if the directory node doesn't exist with the proper
type, the directory paths don't exist or the directory is unavailable.
|
static char |
getDirectoryNodeChar(DirectoryService ds,
java.lang.String nodeId,
char initial,
Utils.DirScope scope,
java.lang.String[] accountIds)
Obtain the specified attribute from the directory if it exists or return
the default value if the directory node doesn't exist with the proper
type, the directory paths don't exist or the directory is unavailable.
|
static int |
getDirectoryNodeInt(DirectoryService ds,
java.lang.String nodeId,
int initial)
Obtain the specified attribute from the directory if it exists or return
the default value if the directory node doesn't exist with the proper
type, the directory paths don't exist or the directory is unavailable.
|
static int |
getDirectoryNodeInt(DirectoryService ds,
java.lang.String nodeId,
int initial,
boolean scope)
Obtain the specified attribute from the directory if it exists or return
the default value if the directory node doesn't exist with the proper
type, the directory paths don't exist or the directory is unavailable.
|
static int |
getDirectoryNodeInt(DirectoryService ds,
java.lang.String nodeId,
int initial,
Utils.DirScope scope,
java.lang.String[] accountIds)
Obtain the specified attribute from the directory if it exists or return
the default value if the directory node doesn't exist with the proper
type, the directory paths don't exist or the directory is unavailable.
|
static java.lang.String |
getDirectoryNodeString(DirectoryService ds,
java.lang.String nodeId,
java.lang.String initial)
Obtain the specified attribute from the directory if it exists or return
the default value if the directory node doesn't exist with the proper
type, the directory paths don't exist or the directory is unavailable.
|
static java.lang.String |
getDirectoryNodeString(DirectoryService ds,
java.lang.String nodeId,
java.lang.String initial,
boolean scope)
Obtain the specified attribute from the directory if it exists or return
the default value if the directory node doesn't exist with the proper
type, the directory paths don't exist or the directory is unavailable.
|
static java.lang.String |
getDirectoryNodeString(DirectoryService ds,
java.lang.String nodeId,
java.lang.String initial,
Utils.DirScope scope,
java.lang.String[] accountIds)
Obtain the specified attribute from the directory if it exists or return
the default value if the directory node doesn't exist with the proper
type, the directory paths don't exist or the directory is unavailable.
|
static java.lang.Object |
getDirectoryNodeWorker(DirectoryService ds,
java.lang.String nodeId,
java.lang.String expected,
Utils.DirectoryHelper helper,
Utils.DirScope scope,
java.lang.String[] accountIds)
Obtain the specified attribute from the directory if it exists or return the
null if
the directory node doesn't exist with the proper type, the directory paths don't exist or
the directory is unavailable. |
static java.lang.String |
getExt(java.lang.String fileName)
Extract extension from the file name
|
static int |
getPortForService(DirectoryService ds,
java.lang.String name)
Obtain the port number which has been mapped in the directory to a given
service name.
|
static java.lang.String |
getProjectToken()
Get the current project token.
|
static java.lang.String |
getRequiredProperty(java.util.Properties props,
java.lang.String key)
Retrieve the property with the specified
key from within
the specified properties. |
static java.lang.String |
getUnqualifiedName(java.lang.Class<?> cls)
Get the short name of a class or interface (everything after the last
dot in the fully qualified class name).
|
static int[] |
integerCollectionToPrimitive(java.util.Collection<java.lang.Integer> list)
Convert a collection of wrapper objects into the corresponding array of
primitive types.
|
static int[][] |
integerMapToPrimitive(java.util.Map<java.lang.Integer,java.lang.Integer> map)
Convert a map of wrapper objects into the corresponding array of
primitive types.
|
static <T> boolean |
intersect(java.util.Set<T> a,
java.util.Set<T> b)
Determines whether two sets have common elements.
|
static <T> void |
intersection(java.util.Set<T> a,
java.util.Set<T> b,
java.util.Set<T> result)
Produces the intersection of two sets and puts it into the third set.
|
static java.lang.Object |
invoke(java.lang.Class<?> cl,
java.lang.reflect.Method entry,
java.lang.Object... args)
Executes the given entry point using reflection, instantiating
the target class first, if necessary.
|
static boolean |
isLaterVersion(java.lang.String source,
java.lang.String target)
Determines if a both source and target exist as files and if the target
has a later timestamp.
|
static <T> boolean |
isSame(java.util.Set<T> a,
java.util.Set<T> b)
Check if the two sets are the same.
|
static java.util.Properties |
loadProperties(java.lang.String filename)
Load and return a
Properties object from a properties
file specified by filename . |
static long[] |
longCollectionToPrimitive(java.util.Collection<java.lang.Long> list)
Convert a collection of wrapper objects into the corresponding array of
primitive types.
|
private static void |
matchPathCaseInsensitively(java.io.File leading,
java.lang.String fullPath,
java.util.List<java.io.File> list)
Find as many files as case-insensitively match the file specified by
fullPath , where the directory specified by
leading represents a leading portion of the given path. |
static java.lang.String |
mimeType(java.lang.String fileName)
Get mimeType of the mouse cursor file
|
static void |
noHelp()
Serves as a placeholder for some interactive help.
|
static java.lang.String |
nonEmpty(java.lang.Object... args)
The method returns the first non-empty trimmed string represented by the supplied
arguments.
|
static <T> T |
nonNull(T... args)
The method returns the first non-null argument from the supplied array of
arguments.
|
static int[] |
objectToPrimitive(java.lang.Integer[] array)
Convert the array of wrapper objects into the corresponding array of
primitive types.
|
static long[] |
objectToPrimitive(java.lang.Long[] array)
Convert the array of wrapper objects into the corresponding array of
primitive types.
|
static java.util.List<java.lang.Integer> |
primitiveToIntegerList(int[] array)
Convert an array of primitive types into a list of the corresponding
wrapper objects.
|
static java.util.List<java.lang.Long> |
primitiveToLongList(long[] array)
Convert an array of primitive types into a list of the corresponding
wrapper objects.
|
static java.lang.Integer[] |
primitiveToObject(int[] array)
Convert the array of primitives into the corresponding array of wrapper
objects.
|
static java.lang.Long[] |
primitiveToObject(long[] array)
Convert the array of primitives into the corresponding array of wrapper
objects.
|
static void |
printChainedErrors(java.lang.Throwable thr,
java.io.PrintStream out,
int indent)
Extract the error message from a throwable and each of its chained
throwables, printing them on consecutive lines using the specified
print stream.
|
static char[] |
prompt(java.lang.String txt)
Displays a prompt on
stdout and returns the input entered
by the user on stdin . |
static <T> void |
removeAllIf(java.util.Collection<T> c,
java.util.function.Predicate<T> p)
Remove all items from that collection which satisfy the given condition
|
static boolean |
removeDirectoryNode(DirectoryService ds,
java.lang.String nodeId)
Removes the specified directory node, including all child nodes.
|
static <T> java.util.stream.Stream<T> |
reverseStream(java.util.LinkedList<T> list)
The method returns a reverse Stream
from the supplied linked list.
|
static <T> java.util.stream.Stream<T> |
reverseStream(java.util.List<T> list)
The method returns a reverse Stream
from the supplied
list . |
static <T> java.util.stream.Stream<T> |
reverseStream(T[] array)
The method returns a reverse Stream
from the supplied
array . |
static <T> T[] |
scroll(T[] source,
int first)
Scroll given array so element with specified index will be first in
array.
|
static void |
setProjectToken(java.lang.String token)
Set the project token for this context.
|
static boolean |
simpleCopy(java.lang.String src,
java.lang.String tar)
Creates the directory tree to the target if needed and then copies
the source to the target if needed.
|
static char |
toChar(byte b,
java.lang.String cset)
Convert the given byte to a Unicode character using the given character
set (or the default charset if the given charset name is
null ). |
static char |
toChar(int i)
Convert the given integer to a Unicode character using the character
set defined as the default for the environment, honoring any override
configured.
|
static char |
toChar(int i,
java.lang.String cset)
Convert the given byte to a Unicode character using the given character
set (or the default charset if the given charset name is
null ). |
static int |
toInt(char ch,
java.lang.String cset)
Convert the given Unicode character to an integer value using the given
character set (or the default charset if the given charset name is
null ). |
static <T,S> T |
tryWhileNull(java.util.List<S> list,
java.util.function.Function<S,T> fn)
Apply function to the list elements while the result is
null |
static int |
uniqueId()
Returns a context-wide unique integer value which can be used as an ID.
|
static void |
verifyDirectoryNode(DirectoryService ds,
java.lang.String id,
java.lang.String expected)
Verify that a directory node at a particular, required directory path
exists, and that the class of the node found at that path is that which
is expected.
|
private static final java.util.logging.Logger LOG
private static Utils.ContextContainer work
private static java.lang.String override
null
for default.private static boolean init
private static java.lang.Object token
private Utils()
public static <T> T[] scroll(T[] source, int first)
NOTE: Scrolling is performed "in place", so input array gets updated!
T
- source
- Source array to scroll.first
- The index of element which will be first.public static int[] objectToPrimitive(java.lang.Integer[] array)
array
- The array of wrapper objects. Must not be null
.public static java.lang.Integer[] primitiveToObject(int[] array)
array
- The array of primitive types. Must not be null
.public static int[] integerCollectionToPrimitive(java.util.Collection<java.lang.Integer> list)
list
- The collection of wrapper objects. Must not be
null
.public static int[][] integerMapToPrimitive(java.util.Map<java.lang.Integer,java.lang.Integer> map)
map
- The map of wrapper objects. Must not be
null
.public static java.util.List<java.lang.Integer> primitiveToIntegerList(int[] array)
array
- The primitive array. Must not be null
.public static long[] objectToPrimitive(java.lang.Long[] array)
array
- The array of wrapper objects. Must not be null
.public static java.lang.Long[] primitiveToObject(long[] array)
array
- The array of primitive types. Must not be null
.public static long[] longCollectionToPrimitive(java.util.Collection<java.lang.Long> list)
list
- The collection of wrapper objects. Must not be
null
.public static java.util.List<java.lang.Long> primitiveToLongList(long[] array)
array
- The primitive array. Must not be null
.public static java.util.Properties loadProperties(java.lang.String filename) throws java.io.IOException
Properties
object from a properties
file specified by filename
.filename
- Name of the properties file.filename
.java.io.IOException
- if any error occurs reading the file.public static java.lang.String getRequiredProperty(java.util.Properties props, java.lang.String key) throws MissingDataException
key
from within
the specified properties. Assume key
represents a required
property; an exception is thrown if it is not present.props
- Properties object from which to retrieve required property.key
- Key to the required property.MissingDataException
- if the required property is not present.public static char[] prompt(java.lang.String txt) throws java.io.IOException
stdout
and returns the input entered
by the user on stdin
. The first new line encountered
will end the input reading loop and the text will not include this
new line character.txt
- The text message to display.null
if there was no input provided.java.io.IOException
public static void printChainedErrors(java.lang.Throwable thr, java.io.PrintStream out, int indent)
thr
- Throwable from which to extract message and chained throwables.out
- Print stream to which messages will be written.indent
- Number of spaces to indent each error message.public static boolean causeChainContains(java.lang.Throwable thr, java.lang.Class[] criteria)
thr
- Throwable from which to examine cause chain.criteria
- List of throwables to check for.true
if any of the criteria throwables matches the given
throwable or any throwable in the cause chain.public static java.lang.String getCharsetName()
The assumption (possibly not always correct) is that UTF-8 is not a valid Progress charset and instead, to provide a proper default, we must override with a compatible charset. Note that if the default charset name is not UTF-8, it is assumed that the charset has been overridden already (at JVM startup). In that case, the default is returned unchanged.
public static java.lang.String getCharsetOverride()
If the 4GL environment is actually configured for UTF-8, then this approach won't work. If the default codepage name for the JVM is not UTF-8, it is assumed that the codepage has been overriden already (at JVM startup). In that case, the value reported by the JVM is returned unchanged.
null
if no override is required.public static char toChar(int i)
getCharsetOverride()
.
The normal ASCII range can be converted to a Unicode character by a simple widening conversion from byte to char. But the extended ASCII range (128 through 255 inclusive) will translate to character values that cannot be achieved via a widening conversion. Instead the proper character set must be used to get the right result.
i
- The integer to convert.public static char toChar(byte b, java.lang.String cset)
null
).
The normal ASCII range can be converted to a Unicode character by a simple widening conversion from byte to char. But the extended ASCII range (128 through 255 inclusive) will translate to character values that cannot be achieved via a widening conversion. Instead the proper character set must be used to get the right result.
b
- The byte to convert.cset
- The charset name to use for conversion or null
if the default charset should be used.public static char toChar(int i, java.lang.String cset)
null
).
Only the least significant byte will be converted, all other data is dropped at this time.
The normal ASCII range can be converted to a Unicode character by a simple widening conversion from byte to char. But the extended ASCII range (128 through 255 inclusive) will translate to character values that cannot be achieved via a widening conversion. Instead the proper character set must be used to get the right result.
i
- The number to convert. Must be between 0 and 255 inclusive.cset
- The charset name to use for conversion or null
if the default charset should be used.public static int toInt(char ch, java.lang.String cset)
null
).
The normal ASCII range can be converted from a Unicode character by a simple narrowing conversion from char to byte. But the Unicode characters representing the extended ASCII range (128 through 255 inclusive) are not represented in Unicode via a single byte. So a translation from character values to a number cannot be achieved via a narrowing conversion. Instead the proper character set must be used to get the right result.
ch
- The Unicode character to convert.cset
- The charset name to use for conversion or null
if the default charset should be used.public static boolean createPathForTarget(java.lang.String tar)
tar
- Target filename for which paths must be created.true
if the full necessary path already
exists or if it has been created, false
otherwise.public static java.io.File findFileInPath(java.lang.String filename, java.lang.String[] paths) throws java.io.FileNotFoundException
filename
- Name of the source file to find; if this is not an absolute
path, it should be relative to one of the paths in the
searchPaths
array.paths
- Array of absolute paths which are prepended to a relative
filename
.java.io.FileNotFoundException
- if a file named filename
does not exist in the
specified search paths (or at the absolute path provided).public static java.lang.String canonicalizePath(java.lang.String path, java.lang.String oldSeparator, java.lang.String newSeparator) throws java.io.IOException
java.io.File.getCanonicalPath()
. In addition, normalize
the use of the file separator by replacing all instances of
oldSeparator
with newSeparator
.path
- A relative or absolute path to be canonicalized.oldSeparator
- File separator to be replaced.newSeparator
- New file separator.java.io.IOException
- If there is a file system while canonicalizing the path.public static boolean isLaterVersion(java.lang.String source, java.lang.String target)
source
- Source filename.target
- Target filename.true
if the both files exist and the target is
newer, otherwise false
(includes failures).public static boolean simpleCopy(java.lang.String src, java.lang.String tar)
src
- Source filename.tar
- Target filename.true
if the file was copied successfully OR
if the file didn't need to be copied, false
on any failure.public static boolean copyFileIfNeeded(java.lang.String source, java.lang.String target, int bsize)
source
- Source filename.target
- Target filename.bsize
- Buffer size or if 0 the buffer size will default to the file
size or 64Kb whichever is less.true
if the file was copied successfully OR if
the file didn't need to be copied, false
on any
failure.public static boolean copyFile(java.lang.String source, java.lang.String target, int bsize, boolean append)
source
- Source filename.target
- Target filename.bsize
- Buffer size or if 0 the buffer size will default to the file
size or 64Kb whichever is less.append
- true
if the output file should be opened in
append mode.true
if the file was copied successfully,
false
on any failure.public static java.util.List<java.io.File> getCaseInsensitiveFilenameMatches(java.lang.String path, java.lang.String separator) throws java.io.IOException
path
- The file name to be matched. It will be canonicalized before
the search is conducted.separator
- Legacy system file separator which will be replaced with the
target system's file separator (in the result list).null
.java.io.IOException
- if there is any error canonicalizing the path
.public static java.util.List<java.io.File> getCaseInsensitiveFilenameMatches(java.lang.String path) throws java.io.IOException
path
- The file name to be matched. It must already be canonicalized
(see canonicalizePath(java.lang.String, java.lang.String, java.lang.String)
) and with all file separators
converted to the current system's file separator character.null
.java.io.IOException
- if there is any error canonicalizing the path
.public static java.lang.String describeContext()
public static java.lang.Object invoke(java.lang.Class<?> cl, java.lang.reflect.Method entry, java.lang.Object... args) throws java.lang.NullPointerException, java.lang.IllegalAccessException, java.lang.IllegalArgumentException, java.lang.reflect.InvocationTargetException, java.lang.InstantiationException
cl
- The class to be instantiated. Must be public. Must have a
public, default constructor, unless entry
is a
static method.entry
- The method to be executed. Must exist within cl
.
May be an instance method or static method; must be
publicly accessible.args
- If the method's signature contains parameters, this is a
variable argument list containing those parameters.void
return then this will return
null
. Note that it is a limitation of the
design of Java method signatures such that we do not
distinguish between a method with a void
return
and a method that has a real return value which is set to
null
.java.lang.NullPointerException
java.lang.IllegalAccessException
java.lang.IllegalArgumentException
java.lang.reflect.InvocationTargetException
java.lang.InstantiationException
public static void verifyDirectoryNode(DirectoryService ds, java.lang.String id, java.lang.String expected) throws java.lang.RuntimeException
ds
- Directory service.id
- ID of node to verify.expected
- Expected class of node.java.lang.RuntimeException
- if directory node does not exist or is of the incorrect class.public static int getDirectoryNodeInt(DirectoryService ds, java.lang.String nodeId, int initial)
This method implements a search algorithm that allows values to be found that are account (user or process) specific or group specific within the current server or a global default for all servers.
The implementation iteratively looks up the directory node under: /server/<serverID>/runtime/<account_or_group>/<id>
If no user/process or group nodes are present, then this is checked: /server/<serverID>/runtime/default/<id>
If no /server/<serverID>/runtime node exists, this is checked (it is the global default area for all servers): /server/default/runtime/<account_or_group>/<id>
Finally, if no user/process or group nodes are present in the global default area, then this is checked: /server/default/runtime/default/<id>
No exceptions are thrown, the given initial value will always be safely returned.
ds
- A bound directory service instance. If this is
null
then the instance will be dynamically
queried and bound for the duration of the method and then
unbound at the end. This is a convenience for situations
in which only a single value is needed. This has negative
performance implications in the case where multiple values
are sequentially obtained.nodeId
- ID of node to obtain. This will be appended to the various
paths listed above (and in the precedence order specified
above).initial
- The default value to return if the directory backed value
cannot be obtained for ANY reason.public static char getDirectoryNodeChar(DirectoryService ds, java.lang.String nodeId, char initial)
This method implements a search algorithm that allows values to be found that are account (user or process) specific or group specific within the current server or a global default for all servers.
The implementation iteratively looks up the directory node under: /server/<serverID>/runtime/<account_or_group>/<id>
If no user/process or group nodes are present, then this is checked: /server/<serverID>/runtime/default/<id>
If no /server/<serverID>/runtime node exists, this is checked (it is the global default area for all servers): /server/default/runtime/<account_or_group>/<id>
Finally, if no user/process or group nodes are present in the global default area, then this is checked: /server/default/runtime/default/<id>
No exceptions are thrown, the given initial value will always be safely returned.
ds
- A bound directory service instance. If this is
null
then the instance will be dynamically
queried and bound for the duration of the method and then
unbound at the end. This is a convenience for situations
in which only a single value is needed. This has negative
performance implications in the case where multiple values
are sequentially obtained.nodeId
- ID of node to obtain. This will be appended to the various
paths listed above (and in the precedence order specified
above).initial
- The default value to return if the directory backed value
cannot be obtained for ANY reason.public static java.lang.String getDirectoryNodeString(DirectoryService ds, java.lang.String nodeId, java.lang.String initial)
This method implements a search algorithm that allows values to be found that are account (user or process) specific or group specific within the current server or a global default for all servers.
The implementation iteratively looks up the directory node under: /server/<serverID>/runtime/<account_or_group>/<id>
If no user/process or group nodes are present, then this is checked: /server/<serverID>/runtime/default/<id>
If no /server/<serverID>/runtime node exists, this is checked (it is the global default area for all servers): /server/default/runtime/<account_or_group>/<id>
Finally, if no user/process or group nodes are present in the global default area, then this is checked: /server/default/runtime/default/<id>
No exceptions are thrown, the given initial value will always be safely returned.
ds
- A bound directory service instance. If this is
null
then the instance will be dynamically
queried and bound for the duration of the method and then
unbound at the end. This is a convenience for situations
in which only a single value is needed. This has negative
performance implications in the case where multiple values
are sequentially obtained.nodeId
- ID of node to obtain. This will be appended to the various
paths listed above (and in the precedence order specified
above).initial
- The default value to return if the directory backed value
cannot be obtained for ANY reason.public static boolean getDirectoryNodeBoolean(DirectoryService ds, java.lang.String nodeId, boolean initial)
This method implements a search algorithm that allows values to be found that are account (user or process) specific or group specific within the current server or a global default for all servers.
The implementation iteratively looks up the directory node under: /server/<serverID>/runtime/<account_or_group>/<id>
If no user/process or group nodes are present, then this is checked: /server/<serverID>/runtime/default/<id>
If no /server/<serverID>/runtime node exists, this is checked (it is the global default area for all servers): /server/default/runtime/<account_or_group>/<id>
Finally, if no user/process or group nodes are present in the global default area, then this is checked: /server/default/runtime/default/<id>
No exceptions are thrown, the given initial value will always be safely returned.
ds
- A bound directory service instance. If this is
null
then the instance will be dynamically
queried and bound for the duration of the method and then
unbound at the end. This is a convenience for situations
in which only a single value is needed. This has negative
performance implications in the case where multiple values
are sequentially obtained.nodeId
- ID of node to obtain. This will be appended to the various
paths listed above (and in the precedence order specified
above).initial
- The default value to return if the directory backed value
cannot be obtained for ANY reason.public static int getDirectoryNodeInt(DirectoryService ds, java.lang.String nodeId, int initial, boolean scope)
This method implements a search algorithm that allows values to be found that are account (user or process) specific or group specific within the current server or a global default for all servers.
The implementation iteratively looks up the directory node under: /server/<serverID>/runtime/<account_or_group>/<id>
If no user/process or group nodes are present, then this is checked: /server/<serverID>/runtime/default/<id>
If no /server/<serverID>/runtime node exists, this is checked (it is the global default area for all servers): /server/default/runtime/<account_or_group>/<id>
Finally, if no user/process or group nodes are present in the global default area, then this is checked: /server/default/runtime/default/<id>
No exceptions are thrown, the given initial value will always be safely returned.
ds
- A bound directory service instance. If this is
null
then the instance will be dynamically
queried and bound for the duration of the method and then
unbound at the end. This is a convenience for situations
in which only a single value is needed. This has negative
performance implications in the case where multiple values
are sequentially obtained.nodeId
- ID of node to obtain. This will be appended to the various
paths listed above (and in the precedence order specified
above).initial
- The default value to return if the directory backed value
cannot be obtained for ANY reason.scope
- true
if account related search, otherwise server
related search is assumed.public static char getDirectoryNodeChar(DirectoryService ds, java.lang.String nodeId, char initial, boolean scope)
This method implements a search algorithm that allows values to be found that are account (user or process) specific or group specific within the current server or a global default for all servers.
The implementation iteratively looks up the directory node under: /server/<serverID>/runtime/<account_or_group>/<id>
If no user/process or group nodes are present, then this is checked: /server/<serverID>/runtime/default/<id>
If no /server/<serverID>/runtime node exists, this is checked (it is the global default area for all servers): /server/default/runtime/<account_or_group>/<id>
Finally, if no user/process or group nodes are present in the global default area, then this is checked: /server/default/runtime/default/<id>
No exceptions are thrown, the given initial value will always be safely returned.
ds
- A bound directory service instance. If this is
null
then the instance will be dynamically
queried and bound for the duration of the method and then
unbound at the end. This is a convenience for situations
in which only a single value is needed. This has negative
performance implications in the case where multiple values
are sequentially obtained.nodeId
- ID of node to obtain. This will be appended to the various
paths listed above (and in the precedence order specified
above).initial
- The default value to return if the directory backed value
cannot be obtained for ANY reason.scope
- true
if account related search, otherwise server
related search is assumed.public static java.lang.String getDirectoryNodeString(DirectoryService ds, java.lang.String nodeId, java.lang.String initial, boolean scope)
This method implements a search algorithm that allows values to be found that are account (user or process) specific or group specific within the current server or a global default for all servers.
The implementation iteratively looks up the directory node under: /server/<serverID>/runtime/<account_or_group>/<id>
If no user/process or group nodes are present, then this is checked: /server/<serverID>/runtime/default/<id>
If no /server/<serverID>/runtime node exists, this is checked (it is the global default area for all servers): /server/default/runtime/<account_or_group>/<id>
Finally, if no user/process or group nodes are present in the global default area, then this is checked: /server/default/runtime/default/<id>
No exceptions are thrown, the given initial value will always be safely returned.
ds
- A bound directory service instance. If this is
null
then the instance will be dynamically
queried and bound for the duration of the method and then
unbound at the end. This is a convenience for situations
in which only a single value is needed. This has negative
performance implications in the case where multiple values
are sequentially obtained.nodeId
- ID of node to obtain. This will be appended to the various
paths listed above (and in the precedence order specified
above).initial
- The default value to return if the directory backed value
cannot be obtained for ANY reason.scope
- true
if account related search, otherwise server
related search is assumed.public static boolean getDirectoryNodeBoolean(DirectoryService ds, java.lang.String nodeId, boolean initial, boolean scope)
This method implements a search algorithm that allows values to be found that are account (user or process) specific or group specific within the current server or a global default for all servers.
The implementation iteratively looks up the directory node under: /server/<serverID>/runtime/<account_or_group>/<id>
If no user/process or group nodes are present, then this is checked: /server/<serverID>/runtime/default/<id>
If no /server/<serverID>/runtime node exists, this is checked (it is the global default area for all servers): /server/default/runtime/<account_or_group>/<id>
Finally, if no user/process or group nodes are present in the global default area, then this is checked: /server/default/runtime/default/<id>
No exceptions are thrown, the given initial value will always be safely returned.
ds
- A bound directory service instance. If this is
null
then the instance will be dynamically
queried and bound for the duration of the method and then
unbound at the end. This is a convenience for situations
in which only a single value is needed. This has negative
performance implications in the case where multiple values
are sequentially obtained.nodeId
- ID of node to obtain. This will be appended to the various
paths listed above (and in the precedence order specified
above).initial
- The default value to return if the directory backed value
cannot be obtained for ANY reason.scope
- true
if account related search, otherwise server
related search is assumed.public static java.lang.String findDirectoryNodePath(DirectoryService ds, java.lang.String nodeId, java.lang.String expected, boolean scope)
null
if the directory node doesn't exist with the proper
type, the directory paths don't exist or the directory is unavailable.
This method implements a search algorithm that allows paths to be found that are account (user or process) specific or group specific within the current server or a global default for all servers.
There are two search scopes: account relayed and server related. Account related search is described below. The server related search is a version of the search that is limited to the first two server related levels.
The implementation iteratively looks up the directory node under: /server/<serverID>/runtime/<account_or_group>/<id>
If no user/process or group nodes are present, then this is checked: /server/<serverID>/runtime/default/<id>
If no /server/<serverID>/runtime node exists, this is checked (it is the global default area for all servers): /server/default/runtime/<account_or_group>/<id>
Finally, if no user/process or group nodes are present in the global default area, then this is checked: /server/default/runtime/default/<id>
ds
- A bound directory service instance. If this is
null
then the instance will be dynamically
queried and bound for the duration of the method and then
unbound at the end. This is a convenience for situations
in which only a single value is needed. This has negative
performance implications in the case where multiple values
are sequentially obtained.nodeId
- ID of node to obtain. This will be appended to the various
paths listed above (and in the precedence order specified
above).expected
- Expected class of node. This will be checked with that
found in the directory for consistency.scope
- true
if account related search, otherwise server
related search is assumed.null
if for ANY
reason the directory node cannot be found.public static int getDirectoryNodeInt(DirectoryService ds, java.lang.String nodeId, int initial, Utils.DirScope scope, java.lang.String[] accountIds)
This method implements a search algorithm that allows values to be found that are account (user or process) specific or group specific within the current server or a global default for all servers.
The implementation iteratively looks up the directory node under: /server/<serverID>/runtime/<account_or_group>/<id>
If no user/process or group nodes are present, then this is checked: /server/<serverID>/runtime/default/<id>
If no /server/<serverID>/runtime node exists, this is checked (it is the global default area for all servers): /server/default/runtime/<account_or_group>/<id>
Finally, if no user/process or group nodes are present in the global default area, then this is checked: /server/default/runtime/default/<id>
No exceptions are thrown, the given initial value will always be safely returned.
If the scope
is set to Utils.DirScope.BOTH
, first a per-account search will be
performed. If the value is not found, it fallbacks to a per-server search.
ds
- A bound directory service instance. If this is
null
then the instance will be dynamically
queried and bound for the duration of the method and then
unbound at the end. This is a convenience for situations
in which only a single value is needed. This has negative
performance implications in the case where multiple values
are sequentially obtained.nodeId
- ID of node to obtain. This will be appended to the various
paths listed above (and in the precedence order specified
above).initial
- The default value to return if the directory backed value
cannot be obtained for ANY reason.scope
- Search mode for the directory node lookup.accountIds
- Explicit list of account IDs which should be included in the search. When
null
, the current context's account IDs are resolved and used.public static char getDirectoryNodeChar(DirectoryService ds, java.lang.String nodeId, char initial, Utils.DirScope scope, java.lang.String[] accountIds)
This method implements a search algorithm that allows values to be found that are account (user or process) specific or group specific within the current server or a global default for all servers.
The implementation iteratively looks up the directory node under: /server/<serverID>/runtime/<account_or_group>/<id>
If no user/process or group nodes are present, then this is checked: /server/<serverID>/runtime/default/<id>
If no /server/<serverID>/runtime node exists, this is checked (it is the global default area for all servers): /server/default/runtime/<account_or_group>/<id>
Finally, if no user/process or group nodes are present in the global default area, then this is checked: /server/default/runtime/default/<id>
No exceptions are thrown, the given initial value will always be safely returned.
If the scope
is set to Utils.DirScope.BOTH
, first a per-account search will be
performed. If the value is not found, it fallbacks to a per-server search.
ds
- A bound directory service instance. If this is
null
then the instance will be dynamically
queried and bound for the duration of the method and then
unbound at the end. This is a convenience for situations
in which only a single value is needed. This has negative
performance implications in the case where multiple values
are sequentially obtained.nodeId
- ID of node to obtain. This will be appended to the various
paths listed above (and in the precedence order specified
above).initial
- The default value to return if the directory backed value
cannot be obtained for ANY reason.scope
- Search mode for the directory node lookup.accountIds
- Explicit list of account IDs which should be included in the search. When
null
, the current context's account IDs are resolved and used.public static java.lang.String getDirectoryNodeString(DirectoryService ds, java.lang.String nodeId, java.lang.String initial, Utils.DirScope scope, java.lang.String[] accountIds)
This method implements a search algorithm that allows values to be found that are account (user or process) specific or group specific within the current server or a global default for all servers.
The implementation iteratively looks up the directory node under: /server/<serverID>/runtime/<account_or_group>/<id>
If no user/process or group nodes are present, then this is checked: /server/<serverID>/runtime/default/<id>
If no /server/<serverID>/runtime node exists, this is checked (it is the global default area for all servers): /server/default/runtime/<account_or_group>/<id>
Finally, if no user/process or group nodes are present in the global default area, then this is checked: /server/default/runtime/default/<id>
No exceptions are thrown, the given initial value will always be safely returned.
If the scope
is set to Utils.DirScope.BOTH
, first a per-account search will be
performed. If the value is not found, it fallbacks to a per-server search.
ds
- A bound directory service instance. If this is
null
then the instance will be dynamically
queried and bound for the duration of the method and then
unbound at the end. This is a convenience for situations
in which only a single value is needed. This has negative
performance implications in the case where multiple values
are sequentially obtained.nodeId
- ID of node to obtain. This will be appended to the various
paths listed above (and in the precedence order specified
above).initial
- The default value to return if the directory backed value
cannot be obtained for ANY reason.scope
- Search mode for the directory node lookup.accountIds
- Explicit list of account IDs which should be included in the search. When
null
, the current context's account IDs are resolved and used.public static boolean getDirectoryNodeBoolean(DirectoryService ds, java.lang.String nodeId, boolean initial, Utils.DirScope scope, java.lang.String[] accountIds)
This method implements a search algorithm that allows values to be found that are account (user or process) specific or group specific within the current server or a global default for all servers.
The implementation iteratively looks up the directory node under: /server/<serverID>/runtime/<account_or_group>/<id>
If no user/process or group nodes are present, then this is checked: /server/<serverID>/runtime/default/<id>
If no /server/<serverID>/runtime node exists, this is checked (it is the global default area for all servers): /server/default/runtime/<account_or_group>/<id>
Finally, if no user/process or group nodes are present in the global default area, then this is checked: /server/default/runtime/default/<id>
No exceptions are thrown, the given initial value will always be safely returned.
If the scope
is set to Utils.DirScope.BOTH
, first a per-account search will be
performed. If the value is not found, it fallbacks to a per-server search.
ds
- A bound directory service instance. If this is
null
then the instance will be dynamically
queried and bound for the duration of the method and then
unbound at the end. This is a convenience for situations
in which only a single value is needed. This has negative
performance implications in the case where multiple values
are sequentially obtained.nodeId
- ID of node to obtain. This will be appended to the various
paths listed above (and in the precedence order specified
above).initial
- The default value to return if the directory backed value
cannot be obtained for ANY reason.scope
- Search mode for the directory node lookup.accountIds
- Explicit list of account IDs which should be included in the search. When
null
, the current context's account IDs are resolved and used.public static byte[] getDirectoryNodeByteArray(DirectoryService ds, java.lang.String nodeId, byte[] initial, Utils.DirScope scope, java.lang.String[] accountIds)
This method implements a search algorithm that allows values to be found that are account (user or process) specific or group specific within the current server or a global default for all servers.
The implementation iteratively looks up the directory node under: /server/<serverID>/runtime/<account_or_group>/<id>
If no user/process or group nodes are present, then this is checked: /server/<serverID>/runtime/default/<id>
If no /server/<serverID>/runtime node exists, this is checked (it is the global default area for all servers): /server/default/runtime/<account_or_group>/<id>
Finally, if no user/process or group nodes are present in the global default area, then this is checked: /server/default/runtime/default/<id>
No exceptions are thrown, the given initial value will always be safely returned.
If the scope
is set to Utils.DirScope.BOTH
, first a per-account search will be
performed. If the value is not found, it fallbacks to a per-server search.
ds
- A bound directory service instance. If this is
null
then the instance will be dynamically
queried and bound for the duration of the method and then
unbound at the end. This is a convenience for situations
in which only a single value is needed. This has negative
performance implications in the case where multiple values
are sequentially obtained.nodeId
- ID of node to obtain. This will be appended to the various
paths listed above (and in the precedence order specified
above).initial
- The default value to return if the directory backed value
cannot be obtained for ANY reason.scope
- Search mode for the directory node lookup.accountIds
- Explicit list of account IDs which should be included in the search. When
null
, the current context's account IDs are resolved and used.public static java.lang.String findDirectoryNodePath(DirectoryService ds, java.lang.String nodeId, java.lang.String expected, Utils.DirScope scope, java.lang.String[] accountIds)
null
if the directory node doesn't exist with the proper
type, the directory paths don't exist or the directory is unavailable.
This method implements a search algorithm that allows paths to be found that are account (user or process) specific or group specific within the current server or a global default for all servers.
There are two search scopes: account relayed and server related. Account related search is described below. The server related search is a version of the search that is limited to the first two server related levels.
The implementation iteratively looks up the directory node under: /server/<serverID>/runtime/<account_or_group>/<id>
If no user/process or group nodes are present, then this is checked: /server/<serverID>/runtime/default/<id>
If no /server/<serverID>/runtime node exists, this is checked (it is the global default area for all servers): /server/default/runtime/<account_or_group>/<id>
Finally, if no user/process or group nodes are present in the global default area, then this is checked: /server/default/runtime/default/<id>
If the scope
is set to Utils.DirScope.BOTH
, first a per-account search will be
performed. If the value is not found, it fallbacks to a per-server search.
ds
- A bound directory service instance. If this is
null
then the instance will be dynamically
queried and bound for the duration of the method and then
unbound at the end. This is a convenience for situations
in which only a single value is needed. This has negative
performance implications in the case where multiple values
are sequentially obtained.nodeId
- ID of node to obtain. This will be appended to the various
paths listed above (and in the precedence order specified
above).expected
- Expected class of node. This will be checked with that
found in the directory for consistency.scope
- Search mode for the directory node lookup.accountIds
- Explicit list of account IDs which should be included in the search. When
null
, the current context's account IDs are resolved and used.null
if for ANY
reason the directory node cannot be found.public static java.lang.Object getDirectoryNodeWorker(DirectoryService ds, java.lang.String nodeId, java.lang.String expected, Utils.DirectoryHelper helper, Utils.DirScope scope, java.lang.String[] accountIds)
null
if
the directory node doesn't exist with the proper type, the directory paths don't exist or
the directory is unavailable.
This method implements a search algorithm that allows values to be found that are account (user or process) specific or group specific within the current server or a global default for all servers.
The implementation iteratively looks up the directory node under:
projectToken
is configured (same stands for next all pairs below):/server/<serverID>/runtime/<account_or_group>/<id>.<project>
;/server/<serverID>/runtime/<account_or_group>/<id>
;/server/<serverID>/runtime/default/<id>.<project>;
/server/<serverID>/runtime/default/<id>;
/server/<serverID>/runtime
node exists, these are checked (it is the
global default area for all servers):/server/default/runtime/<account_or_group>/<id>.<project>;
/server/default/runtime/<account_or_group>/<id>
/server/default/runtime/default/<id>.<project>;
/server/default/runtime/default/<id>
.null
will always be safely
returned.
If the scope
is set to Utils.DirScope.BOTH
, first a per-account search will be
performed. If the value is not found, it fallbacks to a per-server search.ds
- A bound directory service instance. If this is null
then the instance
will be dynamically queried and bound for the duration of the method and then
unbound at the end. This is a convenience for situations in which only a single
value is needed. This has negative performance implications in the case where
multiple values are sequentially obtained.nodeId
- ID of node to obtain. This will be appended to the various paths listed above
(and in the precedence order specified above).expected
- Expected class of node or null
. If given, this will be checked with that
found in the directory for consistency.helper
- The data type-specific helper to query the given node.scope
- Search mode for the directory node lookup.accountIds
- Explicit list of account IDs which should be included in the search. When
null
, the current context's account IDs are resolved and used.null
if for ANY reason the directory backed value
cannot be obtained.public static boolean removeDirectoryNode(DirectoryService ds, java.lang.String nodeId)
ds
- A bound directory service instance with an editing batch opennodeId
- ID of node to removetrue
if removed the node successfullypublic static java.lang.String getExt(java.lang.String fileName)
fileName
- file namepublic static java.lang.String mimeType(java.lang.String fileName)
fileName
- file namepublic static int getPortForService(DirectoryService ds, java.lang.String name)
getservbyname()
API.
It is partial because it only will return a valid port number for services explicitly mapped in the directory. The current implementation knows nothing of the mappings provided in the standard services file. Thus, it should be used only for custom services mapped to ports in the directory.
The following directory paths are checked for mappings in the following precedence order:
/server/<server_id>/port_services/<service>
/server/default/port_services/<service>
where:
<server_id>
is the unique identifier of the
current P2J server instance; and<service>
is the service name given by the
name
parameter to this method.ds
- A bound directory service instance. If this is
null
then the instance will be dynamically
queried and bound for the duration of the method and then
unbound at the end. This is a convenience for situations
in which only a single value is needed. This has negative
performance implications in the case where multiple values
are sequentially obtained.name
- Service name to look up.public static void noHelp()
public static java.lang.String getUnqualifiedName(java.lang.Class<?> cls)
cls
- Class.public static <T,S> T tryWhileNull(java.util.List<S> list, java.util.function.Function<S,T> fn)
null
list
- the list to be traversedfn
- Function to be appliednull
if none foundprivate static void matchPathCaseInsensitively(java.io.File leading, java.lang.String fullPath, java.util.List<java.io.File> list)
fullPath
, where the directory specified by
leading
represents a leading portion of the given path.
This method calls itself recursively with progressively more specific
leading
directories, until leading
represents
the full path qualifier for the file which is the target of the match.
All paths in this method are processed using the current system's file separator character. This means that any input to this method must have already been properly converted to the system file separator.
leading
- A leading portion of the directory qualifier for the
fullPath
argument. The top-level call to this
method would pass null
here. Recursive calls will
pass a value. If given, this MUST be a valid directory in the
file system AND it must be a valid prefix for the target file
(it must case-insensitively match the begining of the target
filename).fullPath
- A canonicalized path name which represents an absolute path of
the file to be matched. Must NOT be null
.list
- A list in which to store matching File
objects
(which is the result of this processing). Must NOT be
null
.private static java.lang.Object executeLookup(DirectoryService ds, java.lang.String root, java.lang.String postfix, java.lang.String nodeId, java.lang.String expected, Utils.DirectoryHelper helper)
root + "/" + postfix + "/" + nodeId
ds
- A bound directory service instance. Must not be
null
.root
- First part of the path to build.postfix
- Second part of the path to build or null
.nodeId
- ID of node to obtain. This will be appended to the two
paths listed above.expected
- Expected class of node or null
. If given, this
will be checked with that found in the directory for
consistency.helper
- The data type-specific helper to query the given node.null
if for ANY
reason the directory backed value cannot be obtained.public static <T> boolean equals(T obj1, T obj2)
null
objects
without fear of NPE. If both provided objects are null
then
they are assumed equal.T
- Type parameter.obj1
- First object for comparison.obj2
- Second object for comparison.true
if objects are equal.public static int uniqueId()
public static void setProjectToken(java.lang.String token)
token
- the token that identifies the project.java.lang.IllegalArgumentException
- if the project was already set for current context.public static java.lang.String getProjectToken()
null
is returned.null
if not previously set.public static <T> boolean isSame(java.util.Set<T> a, java.util.Set<T> b)
null
instances are allowed for
either set.a
- The first set.b
- The second set.true
if the sets match.public static <T> boolean intersect(java.util.Set<T> a, java.util.Set<T> b)
T
- a
- a setb
- another settrue
if there are common elementspublic static <T> void intersection(java.util.Set<T> a, java.util.Set<T> b, java.util.Set<T> result)
T
- a
- a setb
- another setresult
- result setpublic static <T> void difference(java.util.Set<T> a, java.util.Set<T> b, java.util.Set<T> result)
T
- a
- a setb
- another set, which is to be subtracted from 'a'result
- result setpublic static int[] diffIntArrays(int[] a, int[] b)
a
- The first array.b
- The second array which is to be subtracted from the first.public static <T> java.util.stream.Stream<T> reverseStream(T[] array)
array
.array
- The array to be reversed in a stream.public static <T> java.util.stream.Stream<T> reverseStream(java.util.LinkedList<T> list)
list
- The linked list to be reversed in a stream.public static <T> java.util.stream.Stream<T> reverseStream(java.util.List<T> list)
list
.list
- The list to be reversed in a stream.@SafeVarargs public static <T> T nonNull(T... args)
args
- An array of arguments.java.lang.IllegalArgumentException
- when zero arguments is passed to the method.java.lang.NullPointerException
- when no non-null value is found in the supplied array of arguments.@SafeVarargs public static java.lang.String nonEmpty(java.lang.Object... args)
args
- An array of arguments.java.lang.IllegalArgumentException
- when zero arguments is passed to the method or no non-empty string is
represented by any of the supplied arguments.public static <T> void removeAllIf(java.util.Collection<T> c, java.util.function.Predicate<T> p)
c
- the collectionp
- the condition