public void ShouldExtenedLinkedListByFindAllMethod()
        {
            // given
            IEnumerable <int> list   = Lists.AsLinkedList(Lists.AsList(1, 2, 3, 4));
            Predicate <int>   filter = item => item % 2 == 0;

            // when
            var filtered = list.FindAll(filter);

            // then
            Check.That(filtered).IsInstanceOf <LinkedList <int> >();
            Check.That(filtered).ContainsExactly(2, 4);
        }
        /// <summary>
        /// Returns filtered collection items by given predicate.
        /// </summary>
        /// <typeparam name="T">Type of collection item</typeparam>
        /// <param name="source">this</param>
        /// <param name="filter">Item filter</param>
        /// <returns>Filtered collection</returns>
        public static IEnumerable <T> FindAll <T>(this IEnumerable <T> source, Predicate <T> filter)
        {
            Preconditions.IsNotNull(source, () => new ArgumentNullException("source"));
            if (source is List <T> )
            {
                return(((List <T>)source).FindAll(filter));
            }
            if (source is ISet <T> )
            {
                return(FindAll((ISet <T>)source, filter));
            }
            var filtered = source.Where(item => filter(item)).ToList();

            if (source is LinkedList <T> )
            {
                return(Lists.AsLinkedList(filtered));
            }
            return(filtered);
        }
 protected override ICollection <TValue> ResultCollection(ICollection <TValue> collection)
 {
     return(Lists.AsLinkedList(collection));
 }