private static Array UnderlyingEvents(
            IDictionary <object, object> submap,
            Type underlyingClass)
        {
            if (submap.IsEmpty())
            {
                return(Arrays.CreateInstanceChecked(underlyingClass, 0));
            }

            ArrayDeque <EventBean> events = new ArrayDeque <EventBean>(4);

            foreach (KeyValuePair <object, object> entry in submap)
            {
                AggregatorAccessSortedImpl.CheckedPayloadAddAll(events, entry.Value);
            }

            var array = Arrays.CreateInstanceChecked(underlyingClass, events.Count);
            int index = 0;

            foreach (EventBean @event in events)
            {
                array.SetValue(@event.Underlying, index++);
            }

            return(array);
        }
        private static ICollection <EventBean> CollEvents(IDictionary <object, object> submap)
        {
            if (submap.IsEmpty())
            {
                return(EmptyList <EventBean> .Instance);
            }

            ArrayDeque <EventBean> events = new ArrayDeque <EventBean>(4);

            foreach (KeyValuePair <object, object> entry in submap)
            {
                AggregatorAccessSortedImpl.CheckedPayloadAddAll(events, entry.Value);
            }

            return(events);
        }