예제 #1
0
        public static T TryPeek <T>(this IPop <T> c, T defaultValue)
        {
            bool isEmpty;
            T    value = c.TryPeek(out isEmpty);

            return(isEmpty ? defaultValue : value);
        }
예제 #2
0
        public static bool TryPeek <T>(this IPop <T> c, out T value)
        {
            bool isEmpty;

            value = c.TryPeek(out isEmpty);
            return(!isEmpty);
        }
예제 #3
0
        public static T Peek <T>(this IPop <T> c)
        {
            bool isEmpty;
            T    next = c.TryPeek(out isEmpty);

            if (isEmpty)
            {
                throw new InvalidOperationException("The {0} is empty".Localized(c.GetType().Name));
            }
            return(next);
        }
예제 #4
0
        public static T Peek <T>(this IPop <T> c)
        {
            bool isEmpty;
            T    next = c.TryPeek(out isEmpty);

            if (isEmpty)
            {
                throw new EmptySequenceException("The {0} is empty".Localized(MemoizedTypeName.Get(c.GetType())));
            }
            return(next);
        }
예제 #5
0
        public static T TryPeek <T>(this IPop <T> c)
        {
            bool isEmpty;

            return(c.TryPeek(out isEmpty));
        }