Search code examples
javalinqlambdaj

LINQ's Single in java?


Is there an equivalent to LINQ's Single in java? Perhaps in lambdaj?


Solution

  • Using Guava:

    Iterables.getOnlyElement(Iterable< T > iterable)