fj.data.Option.somes()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(2.6k)|赞(0)|评价(0)|浏览(131)

本文整理了Java中fj.data.Option.somes()方法的一些代码示例,展示了Option.somes()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Option.somes()方法的具体详情如下:
包路径:fj.data.Option
类名称:Option
方法名:somes

Option.somes介绍

[英]Returns all the values in the given list.
[中]返回给定列表中的所有值。

代码示例

代码示例来源:origin: org.functionaljava/functionaljava

/**
 * Returns a NonEmptyList of the tails of this list. A list is considered a tail of itself for the purpose of this
 * function (Comonad pattern).
 *
 * @return A NonEmptyList of the tails of this list.
 */
public NonEmptyList<NonEmptyList<A>> tails() {
 return fromList(somes(toList().tails().map(NonEmptyList::fromList))).some();
}

代码示例来源:origin: org.functionaljava/functionaljava

/**
 * Returns a NonEmptyList of the sublists of this list.
 *
 * @return a NonEmptyList of the sublists of this list.
 */
public NonEmptyList<NonEmptyList<A>> sublists() {
 return fromList(
   somes(toList().toStream().substreams()
     .map(F1Functions.o(NonEmptyList::fromList, Conversions.Stream_List())).toList())).some();
}

代码示例来源:origin: no.arktekk.unix/unix-sysv-pkg

public List<String> toList()
{
  F<List<String>, String> folder = List.<String, String>foldLeft().f( joiner.f( " " ) ).f( "" );
  F<List<String>, String> stringF = FunctionF.compose( curry( concat, "CLASSES=" ), trim, folder );
  List<Option<String>> list = List.<Option<String>>single( some( "ARCH=" + arch ) ).
    cons( some( "CATEGORY=" + category ) ).
    cons( some( "NAME=" + name ) ).
    cons( some( "PKG=" + pkg ) ).
    cons( some( "VERSION=" + version ) ).
    cons( pstamp.map( curry( concat, "PSTAMP=" ) ) ).
    cons( desc.map( curry( concat, "DESC=" ) ) ).
    cons( email.map( curry( concat, "EMAIL=" ) ) ).
    cons( iif( List.<String>isNotEmpty_(), classes ).map( stringF ) );
  return Option.somes( list ).reverse();
}

代码示例来源:origin: com.stratio.mojo.unix/unix-sysv-pkg

public List<String> toList()
{
  F<List<String>, String> folder = List.<String, String>foldLeft().f( joiner.f( " " ) ).f( "" );
  F<List<String>, String> stringF = FunctionF.compose( curry( concat, "CLASSES=" ), trim, folder );
  List<Option<String>> list = List.<Option<String>>single( some( "ARCH=" + arch ) ).
    cons( some( "CATEGORY=" + category ) ).
    cons( some( "NAME=" + name ) ).
    cons( some( "PKG=" + pkg ) ).
    cons( some( "VERSION=" + version ) ).
    cons( pstamp.map( curry( concat, "PSTAMP=" ) ) ).
    cons( desc.map( curry( concat, "DESC=" ) ) ).
    cons( email.map( curry( concat, "EMAIL=" ) ) ).
    cons( size.map( curry( concat, "SIZE=" ) ) ).
    cons( iif( List.<String>isNotEmpty_(), classes ).map( stringF ) );
  return Option.somes( list ).reverse();
}

相关文章