Esempio n. 1
0
        internal static List <T> orderedBy <T, R>(Iterable <T> iterable, Function <T, R> getKey)
        {
            var result = FromJava.IterableToEnumerable(iterable)
                         .OrderBy(getKey.apply)
                         .ToList();

            return(ToJava.ListToList(result));
        }
Esempio n. 2
0
        internal static List <T> eagerConcat <T>(Iterable <T> first, Iterable <T> second)
        {
            var result = FromJava.IterableToEnumerable(first)
                         .Concat(FromJava.IterableToEnumerable(second))
                         .ToList();

            return(ToJava.ListToList(result));
        }
Esempio n. 3
0
        internal static List <U> eagerFlatMap <T, U>(Iterable <T> iterable, Function <T, Iterable <U> > function)
        {
            var result = FromJava.IterableToEnumerable(iterable)
                         .SelectMany(element => FromJava.IterableToEnumerable(function.apply(element)))
                         .ToList();

            return(ToJava.ListToList(result));
        }
Esempio n. 4
0
        internal static List <T> cons <T>(T head, Iterable <T> tail)
        {
            var result = new T[] { head }
            .Concat(FromJava.IterableToEnumerable(tail))
            .ToList();

            return(ToJava.ListToList(result));
        }
Esempio n. 5
0
        internal static List <U> eagerMapWithIndex <T, U>(Iterable <T> iterable, BiFunction <int, T, U> function)
        {
            var result = FromJava.IterableToEnumerable(iterable)
                         .Select((value, index) => function.apply(index, value))
                         .ToList();

            return(ToJava.ListToList(result));
        }
Esempio n. 6
0
        internal static List <U> eagerMap <T, U>(Iterable <T> iterable, Function <T, U> function)
        {
            var result = FromJava.IterableToEnumerable(iterable)
                         .Select(function.apply)
                         .ToList();

            return(ToJava.ListToList(result));
        }
Esempio n. 7
0
        internal static List <T> eagerFilter <T>(Iterable <T> iterable, Predicate <T> function)
        {
            var result = FromJava.IterableToEnumerable(iterable)
                         .Where(function.test)
                         .ToList();

            return(ToJava.ListToList(result));
        }
Esempio n. 8
0
        internal static Map <K, java.util.List <T> > toMultiMapWithKey <T, K>(Iterable <T> iterable, Function <T, K> function)
        {
            var dictionary = FromJava.IterableToEnumerable(iterable)
                             .GroupBy(value => function.apply(value))
                             .ToDictionary(
                grouping => grouping.Key,
                grouping => ToJava.ListToList(grouping.ToList()));

            return(ToJava.DictionaryToMap(dictionary));
        }
Esempio n. 9
0
        internal static Map <K, java.util.List <V> > toMultiMap <T, K, V>(Iterable <T> iterable, Function <T, Map__Entry <K, V> > function)
        {
            var dictionary = FromJava.IterableToEnumerable(iterable)
                             .Select(element => function.apply(element))
                             .GroupBy(entry => entry.getKey())
                             .ToDictionary(
                grouping => grouping.Key,
                grouping => ToJava.ListToList(grouping.Select(entry => entry.getValue()).ToList()));

            return(ToJava.DictionaryToMap(dictionary));
        }
Esempio n. 10
0
 internal static List <T> asList <T>(T[] elements)
 {
     return(ToJava.ListToList(elements));
 }
Esempio n. 11
0
 internal static List <T> list <T>(params T[] values)
 {
     return(ToJava.ListToList(values));
 }
Esempio n. 12
0
 internal static List <T> toList <T>(Iterable <T> iterable)
 {
     return(ToJava.ListToList(FromJava.IterableToEnumerable(iterable).ToList()));
 }