当前位置: 首页>>代码示例>>Java>>正文


Java ArrayHelper.findFirst方法代码示例

本文整理汇总了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);
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:8,代码来源:EnumHelper.java

示例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);
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:49,代码来源:WatchDir.java

示例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));
}
 
开发者ID:phax,项目名称:peppol-directory,代码行数:6,代码来源:PublicSearchXServletHandler.java

示例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));
}
 
开发者ID:phax,项目名称:ph-ubl,代码行数:18,代码来源:UBL22DocumentTypes.java

示例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));
}
 
开发者ID:phax,项目名称:ph-ubl,代码行数:18,代码来源:UBL21DocumentTypes.java

示例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));
}
 
开发者ID:phax,项目名称:ph-ubl,代码行数:18,代码来源:UBLTRDocumentTypes.java

示例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));
}
 
开发者ID:phax,项目名称:ph-ubl,代码行数:18,代码来源:UBL20DocumentTypes.java


注:本文中的com.helger.commons.collection.ArrayHelper.findFirst方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。