本文整理汇总了Java中com.helger.commons.collection.ArrayHelper.findFirst方法的典型用法代码示例。如果您正苦于以下问题:Java ArrayHelper.findFirst方法的具体用法?Java ArrayHelper.findFirst怎么用?Java ArrayHelper.findFirst使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.helger.commons.collection.ArrayHelper
的用法示例。
在下文中一共展示了ArrayHelper.findFirst方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: findFirst
import com.helger.commons.collection.ArrayHelper; //导入方法依赖的package包/类
@Nonnull
public static <ENUMTYPE extends Enum <ENUMTYPE>> ENUMTYPE findFirst (@Nonnull final Class <ENUMTYPE> aClass,
@Nullable final Predicate <? super ENUMTYPE> aFilter,
@Nullable final ENUMTYPE eDefault)
{
return ArrayHelper.findFirst (aClass.getEnumConstants (), aFilter, eDefault);
}
示例2: WatchDir
import com.helger.commons.collection.ArrayHelper; //导入方法依赖的package包/类
/**
* Creates a WatchService and registers the given directory
*
* @param aDir
* The directory to be watched. May not be <code>null</code>.
* @param bRecursive
* <code>true</code> to watch the directory recursive,
* <code>false</code> to watch just this directory.
* @throws IOException
* In case something goes wrong.
*/
public WatchDir (@Nonnull final Path aDir, final boolean bRecursive) throws IOException
{
ValueEnforcer.notNull (aDir, "Directory");
ValueEnforcer.isTrue (Files.isDirectory (aDir), () -> "Provided path is not a directory: " + aDir);
m_aWatcher = FileSystems.getDefault ().newWatchService ();
m_aStartDir = aDir.toRealPath ();
m_bRecursive = bRecursive;
boolean bRegisterRecursiveManually = bRecursive;
// Windows only!
if (bRecursive && EOperatingSystem.WINDOWS.isCurrentOS ())
{
// Reflection, as this is for Windows/Oracle JDK only!
// Shortcut for com.sun.nio.file.ExtendedWatchEventModifier.FILE_TREE
final Class <?> aClass = GenericReflection.getClassFromNameSafe ("com.sun.nio.file.ExtendedWatchEventModifier");
if (aClass != null)
{
// Use the special "register recursive" on Windows (enum constant
// "FILE_TREE")
@SuppressWarnings ("unchecked")
final Enum <?> [] aEnumConstants = ((Class <Enum <?>>) aClass).getEnumConstants ();
final Enum <?> aFileTree = ArrayHelper.findFirst (aEnumConstants, x -> x.name ().equals ("FILE_TREE"));
if (aFileTree != null)
{
m_aModifiers = new WatchEvent.Modifier [] { (WatchEvent.Modifier) aFileTree };
bRegisterRecursiveManually = false;
}
}
}
m_bRegisterRecursiveManually = bRegisterRecursiveManually;
if (m_bRegisterRecursiveManually)
_registerDirRecursive (m_aStartDir);
else
_registerDir (m_aStartDir);
}
示例3: getFromPathInfoOrNull
import com.helger.commons.collection.ArrayHelper; //导入方法依赖的package包/类
@Nullable
public static ESearchVersion getFromPathInfoOrNull (@Nonnull final String sPathInfo)
{
return ArrayHelper.findFirst (values (), x -> sPathInfo.startsWith (x.m_sPathPrefix));
}
示例4: getDocumentTypeOfImplementationClass
import com.helger.commons.collection.ArrayHelper; //导入方法依赖的package包/类
/**
* Get the UBL 2.2 document type matching the passed implementation class.
*
* @param aImplClass
* The implementation class to use. May be <code>null</code>.
* @return <code>null</code> if the implementation class is <code>null</code>
* or if no UBL 2.2 document type has the specified implementation
* class.
*/
@Nullable
public static EUBL22DocumentType getDocumentTypeOfImplementationClass (@Nullable final Class <?> aImplClass)
{
if (aImplClass == null)
return null;
return ArrayHelper.findFirst (EUBL22DocumentType.values (),
eDocType -> eDocType.getImplementationClass ().equals (aImplClass));
}
示例5: getDocumentTypeOfImplementationClass
import com.helger.commons.collection.ArrayHelper; //导入方法依赖的package包/类
/**
* Get the UBL 2.1 document type matching the passed implementation class.
*
* @param aImplClass
* The implementation class to use. May be <code>null</code>.
* @return <code>null</code> if the implementation class is <code>null</code>
* or if no UBL 2.1 document type has the specified implementation
* class.
*/
@Nullable
public static EUBL21DocumentType getDocumentTypeOfImplementationClass (@Nullable final Class <?> aImplClass)
{
if (aImplClass == null)
return null;
return ArrayHelper.findFirst (EUBL21DocumentType.values (),
eDocType -> eDocType.getImplementationClass ().equals (aImplClass));
}
示例6: getDocumentTypeOfImplementationClass
import com.helger.commons.collection.ArrayHelper; //导入方法依赖的package包/类
/**
* Get the UBLTR document type matching the passed implementation class.
*
* @param aImplClass
* The implementation class to use. May be <code>null</code>.
* @return <code>null</code> if the implementation class is <code>null</code>
* or if no UBLTR document type has the specified implementation
* class.
*/
@Nullable
public static EUBLTRDocumentType getDocumentTypeOfImplementationClass (@Nullable final Class <?> aImplClass)
{
if (aImplClass == null)
return null;
return ArrayHelper.findFirst (EUBLTRDocumentType.values (),
eDocType -> eDocType.getImplementationClass ().equals (aImplClass));
}
示例7: getDocumentTypeOfImplementationClass
import com.helger.commons.collection.ArrayHelper; //导入方法依赖的package包/类
/**
* Get the UBL 2.0 document type matching the passed implementation class.
*
* @param aImplClass
* The implementation class to use. May be <code>null</code>.
* @return <code>null</code> if the implementation class is <code>null</code>
* or if no UBL 2.0 document type has the specified implementation
* class.
*/
@Nullable
public static EUBL20DocumentType getDocumentTypeOfImplementationClass (@Nullable final Class <?> aImplClass)
{
if (aImplClass == null)
return null;
return ArrayHelper.findFirst (EUBL20DocumentType.values (),
eDocType -> eDocType.getImplementationClass ().equals (aImplClass));
}