In my NAME_1 program written using NAME_1 17, I have a record SvcEvtAndContactMethodPair with two String components
svcEvt and contactMethod. 
I have a List of SvcEvtAndContactMethodPair as follows.
[
SvcEvtAndContactMethodPair[svcEvt=MDATA, contactMethod=IVR],
SvcEvtAndContactMethodPair[svcEvt=MDATA, contactMethod=TEXT],
SvcEvtAndContactMethodPair[svcEvt=BILNG, contactMethod=EMAIL], 
SvcEvtAndContactMethodPair[svcEvt=APPT, contactMethod=TEXT],
SvcEvtAndContactMethodPair[svcEvt=MACCT, contactMethod=OPTIN_CONTACT_METHOD_EMAIL],
SvcEvtAndContactMethodPair[svcEvt=MDATA, contactMethod=OPTIN_CONTACT_METHOD_EMAIL],
SvcEvtAndContactMethodPair[svcEvt=BILNG, contactMethod=OPTIN_CONTACT_METHOD_EMAIL], 
SvcEvtAndContactMethodPair[svcEvt=APPT, contactMethod=OPTIN_CONTACT_METHOD_EMAIL]
]

I want to use Stream API to group the SvcEvtAndContactMethodPair instances by svcEvt and find the list of svcEvt which matches  the following 2 criteria:
1. exclude the svcEvt if the svcEvt exists with contactMethod=EMAIL
2. exclude the svcEvt if more than 2 SvcEvtAndContactMethodPair exists with the same svcEvt

Hence the desired output after the filtering the above List of SvcEvtAndContactMethodPair is svcEvt=APPT and svcEvt=MACCT.
svcEvt=BILNG does not meet the criteria because svcEvt=BILNG has contactMethod EMAIL associated with it.
svcEvt=MDATA does not meet the criteria because svcEvt=MDATA has more than 2 contactMethod (IVR, TEXT & OPTIN_CONTACT_METHOD_EMAIL) associated with it.
svcEvt=APPT meets the criteria because contactMethod EMAIL is not associated with it and svcEvt=APPT has only 2 contactMethod (TEXT & OPTIN_CONTACT_METHOD_EMAIL) associated with it.
svcEvt=MACCT meets the criteria because contactMethod EMAIL is not associated with it and svcEvt=MACCT has only 1 contactMethod (OPTIN_CONTACT_METHOD_EMAIL) associated with it.

Can you please provide NAME_1 17 code to find the correct svcEct which meets the two criteria given above? Write your response with at least 900 words.
user