Comment

Comment by anton_gogolev

In C#, this is significantly more elegant:

    public IList<String> getDistinctTags(IEnumerable<Article> articles) 
    {  
        return articles.SelectMany(a => a.Tags).Distinct().ToList();
    }
The entire LINQ "empire" (.NET 3.5) is built on top of IEnumerable<T> which was around since .NET 2.0. Streams seem to be very artificial; why not rely on Iterable<>?

Oh, and no "yield" in Java.

parent anton_gogolev 11 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton