本文整理汇总了Java中com.helger.commons.collection.ArrayHelper.isEmpty方法的典型用法代码示例。如果您正苦于以下问题:Java ArrayHelper.isEmpty方法的具体用法?Java ArrayHelper.isEmpty怎么用?Java ArrayHelper.isEmpty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.helger.commons.collection.ArrayHelper
的用法示例。
在下文中一共展示了ArrayHelper.isEmpty方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getFormattedText
import com.helger.commons.collection.ArrayHelper; //导入方法依赖的package包/类
@Nullable
public static String getFormattedText (@Nullable final String sText, @Nullable final Object... aArgs)
{
if (sText == null)
{
// Avoid NPE in MessageFormat
return null;
}
if (ArrayHelper.isEmpty (aArgs))
{
// Return text unchanged
return sText;
}
final MessageFormat aMF = new MessageFormat (sText, Locale.getDefault (Locale.Category.FORMAT));
return aMF.format (aArgs);
}
示例2: newQueueMapped
import com.helger.commons.collection.ArrayHelper; //导入方法依赖的package包/类
@Nonnull
@ReturnsMutableCopy
public static <SRCTYPE, DSTTYPE> PriorityQueue <DSTTYPE> newQueueMapped (@Nullable final SRCTYPE [] aArray,
@Nonnull final Function <? super SRCTYPE, DSTTYPE> aMapper)
{
if (ArrayHelper.isEmpty (aArray))
return newQueue (0);
final PriorityQueue <DSTTYPE> ret = newQueue (aArray.length);
for (final SRCTYPE aValue : aArray)
ret.add (aMapper.apply (aValue));
return ret;
}
示例3: newQueue
import com.helger.commons.collection.ArrayHelper; //导入方法依赖的package包/类
@Nonnull
@ReturnsMutableCopy
@SafeVarargs
public static <ELEMENTTYPE> PriorityQueue <ELEMENTTYPE> newQueue (@Nullable final ELEMENTTYPE... aValues)
{
// Don't user Arrays.asQueue since aIter returns an unmodifiable list!
if (ArrayHelper.isEmpty (aValues))
return newQueue (0);
final PriorityQueue <ELEMENTTYPE> ret = newQueue (aValues.length);
Collections.addAll (ret, aValues);
return ret;
}
示例4: newVectorMapped
import com.helger.commons.collection.ArrayHelper; //导入方法依赖的package包/类
@Nonnull
@ReturnsMutableCopy
public static <SRCTYPE, DSTTYPE> CommonsVector <DSTTYPE> newVectorMapped (@Nullable final SRCTYPE [] aArray,
@Nonnull final Function <? super SRCTYPE, DSTTYPE> aMapper)
{
if (ArrayHelper.isEmpty (aArray))
return newVector (0);
final CommonsVector <DSTTYPE> ret = newVector (aArray.length);
ret.addAllMapped (aArray, aMapper);
return ret;
}
示例5: newVector
import com.helger.commons.collection.ArrayHelper; //导入方法依赖的package包/类
@Nonnull
@ReturnsMutableCopy
@SafeVarargs
public static <ELEMENTTYPE> CommonsVector <ELEMENTTYPE> newVector (@Nullable final ELEMENTTYPE... aValues)
{
// Don't user Arrays.asVector since aIter returns an unmodifiable list!
if (ArrayHelper.isEmpty (aValues))
return newVector (0);
return new CommonsVector <> (aValues);
}
示例6: createWithAllThreads
import com.helger.commons.collection.ArrayHelper; //导入方法依赖的package包/类
@Nonnull
public static ThreadDescriptorList createWithAllThreads ()
{
// add dump of all threads
final StopWatch aSW = StopWatch.createdStarted ();
final ThreadDescriptorList ret = new ThreadDescriptorList ();
try
{
// Get all stack traces, sorted by thread ID
for (final Map.Entry <Thread, StackTraceElement []> aEntry : CollectionHelper.getSortedByKey (Thread.getAllStackTraces (),
Comparator.comparing (Thread::getId))
.entrySet ())
{
final StackTraceElement [] aStackTrace = aEntry.getValue ();
final String sStackTrace = ArrayHelper.isEmpty (aStackTrace) ? "No stack trace available!\n"
: StackTraceHelper.getStackAsString (aStackTrace,
false);
ret.addDescriptor (new ThreadDescriptor (aEntry.getKey (), sStackTrace));
}
}
catch (final Throwable t)
{
s_aLogger.error ("Error collecting all thread descriptors", t);
ret.setError ("Error collecting all thread descriptors: " + _getAsString (t));
}
finally
{
final long nMillis = aSW.stopAndGetMillis ();
if (nMillis > 1000)
s_aLogger.warn ("Took " + nMillis + " ms to get all thread descriptors!");
}
return ret;
}
示例7: getListOfFields
import com.helger.commons.collection.ArrayHelper; //导入方法依赖的package包/类
/**
* Get a sub-list with all entries for the specified field names
*
* @param aSearchFieldNames
* The field names to search.
* @return Never <code>null</code>.
*/
@Nonnull
@ReturnsMutableCopy
default IErrorList getListOfFields (@Nullable final String... aSearchFieldNames)
{
if (ArrayHelper.isEmpty (aSearchFieldNames))
{
// Empty sublist
return getSubList (x -> false);
}
return getSubList (x -> x.hasErrorFieldName () && ArrayHelper.contains (aSearchFieldNames, x.getErrorFieldName ()));
}
示例8: getListOfFieldsStartingWith
import com.helger.commons.collection.ArrayHelper; //导入方法依赖的package包/类
/**
* Get a sub-list with all entries that have field names starting with one of
* the supplied names.
*
* @param aSearchFieldNames
* The field names to search.
* @return Never <code>null</code>.
*/
@Nonnull
@ReturnsMutableCopy
default IErrorList getListOfFieldsStartingWith (@Nullable final String... aSearchFieldNames)
{
if (ArrayHelper.isEmpty (aSearchFieldNames))
{
// Empty sublist
return getSubList (x -> false);
}
return getSubList (x -> x.hasErrorFieldName () &&
ArrayHelper.containsAny (aSearchFieldNames, y -> x.getErrorFieldName ().startsWith (y)));
}
示例9: getClassArray
import com.helger.commons.collection.ArrayHelper; //导入方法依赖的package包/类
/**
* Get an array with all the classes of the passed object array.
*
* @param aObjs
* The object array. May be <code>null</code>. No contained element may
* be <code>null</code>.
* @return A non-<code>null</code> array of classes.
*/
@Nonnull
public static Class <?> [] getClassArray (@Nullable final Object... aObjs)
{
if (ArrayHelper.isEmpty (aObjs))
return EMPTY_CLASS_ARRAY;
final Class <?> [] ret = new Class <?> [aObjs.length];
for (int i = 0; i < aObjs.length; ++i)
ret[i] = aObjs[i].getClass ();
return ret;
}
示例10: getImplodedMapped
import com.helger.commons.collection.ArrayHelper; //导入方法依赖的package包/类
/**
* Get a concatenated String from all elements of the passed array, without a
* separator.
*
* @param aElements
* The container to convert. May be <code>null</code> or empty.
* @param aMapper
* The mapping function to convert from ELEMENTTYPE to String. May not
* be <code>null</code>.
* @return The concatenated string.
* @param <ELEMENTTYPE>
* The type of elements to be imploded.
* @since 8.5.6
*/
@Nonnull
public static <ELEMENTTYPE> String getImplodedMapped (@Nullable final ELEMENTTYPE [] aElements,
@Nonnull final Function <? super ELEMENTTYPE, String> aMapper)
{
ValueEnforcer.notNull (aMapper, "Mapper");
if (ArrayHelper.isEmpty (aElements))
return "";
return getImplodedMapped (aElements, 0, aElements.length, aMapper);
}
示例11: getImplodedMappedNonEmpty
import com.helger.commons.collection.ArrayHelper; //导入方法依赖的package包/类
/**
* Get a concatenated String from all elements of the passed array, separated
* by the specified separator string. This the very generic version of
* {@link #getConcatenatedOnDemand(String, String, String)} for an arbitrary
* number of elements.
*
* @param sSep
* The separator to use. May not be <code>null</code>.
* @param aElements
* The container to convert. May be <code>null</code> or empty.
* @param aMapper
* The mapping function to convert from ELEMENTTYPE to String. May not
* be <code>null</code>.
* @return The concatenated string.
* @param <ELEMENTTYPE>
* Array component type
* @since 8.5.6
*/
@Nonnull
public static <ELEMENTTYPE> String getImplodedMappedNonEmpty (@Nonnull final String sSep,
@Nullable final ELEMENTTYPE [] aElements,
@Nonnull final Function <? super ELEMENTTYPE, String> aMapper)
{
ValueEnforcer.notNull (sSep, "Separator");
ValueEnforcer.notNull (aMapper, "Mapper");
if (ArrayHelper.isEmpty (aElements))
return "";
return getImplodedMappedNonEmpty (sSep, aElements, 0, aElements.length, aMapper);
}
示例12: convertByteArrayToCertficate
import com.helger.commons.collection.ArrayHelper; //导入方法依赖的package包/类
/**
* Convert the passed byte array to an X.509 certificate object.
*
* @param aCertBytes
* The original certificate bytes. May be <code>null</code> or empty.
* @return <code>null</code> if the passed byte array is <code>null</code> or
* empty
* @throws CertificateException
* In case the passed string cannot be converted to an X.509
* certificate.
*/
@Nullable
public static X509Certificate convertByteArrayToCertficate (@Nullable final byte [] aCertBytes) throws CertificateException
{
if (ArrayHelper.isEmpty (aCertBytes))
return null;
// Certificate is always ISO-8859-1 encoded
return convertStringToCertficate (new String (aCertBytes, CERT_CHARSET));
}