예제 #1
0
        public static T ReverseLookup <T>(this StackingLinkedList <T> sll, Func <T, bool> lookupUntilPredicate) where T : class
        {
            var currentNode = sll.Previous;

            while (currentNode != null && lookupUntilPredicate(currentNode.Value))
            {
                currentNode = currentNode.Previous;
            }

            return(currentNode?.Value);
        }
예제 #2
0
 public static IEnumerable <T> GetAncestors <T>(this StackingLinkedList <T> sll) where T : class
 {
     return(sll.ToList().Reverse());
 }