public class Helper
extends java.lang.Object
Constructor and Description |
---|
Helper() |
Modifier and Type | Method and Description |
---|---|
static BroadcastList |
getBroadcastListFromNickname(java.util.List<BroadcastList> lists,
java.lang.String nickname)
Given a nickname as a String return the BroadcastList from the List of
BroadcastLists
|
static User |
getUserFromNickname(java.util.List<User> users,
java.lang.String nickname)
Given a nickname as a String return the User object from the List of
Users
|
static boolean |
isExistingGlobalContact(java.lang.String nickname)
Given a nickname determine whether a User exists globally with that
nickname
|
static void |
populateData(java.lang.String filename)
Populate data from the file with the given path
|
public static User getUserFromNickname(java.util.List<User> users, java.lang.String nickname)
users
- the list of users from which a user will be returnednickname
- the nickname of the user to be returnedpublic static BroadcastList getBroadcastListFromNickname(java.util.List<BroadcastList> lists, java.lang.String nickname)
lists
- the list of lists from which one list object is to be
returnednickname
- the nickname of the broadcast list to be returnedpublic static boolean isExistingGlobalContact(java.lang.String nickname)
nickname
- the nickname to check forpublic static void populateData(java.lang.String filename) throws java.io.FileNotFoundException, java.io.IOException, WhatsAppRuntimeException, java.text.ParseException
filename
- the path to the input filejava.io.FileNotFoundException
- this is thrown if the file is not foundjava.io.IOException
- this is thrown if some error occurs while reading the
input fileWhatsAppRuntimeException
- this is thrown if any invalid data is
used to construct any of the WhatsApp objects or a line is encountered
that does not begin with any of the four words mentioned in the
specificationjava.text.ParseException
- this exception is thrown if some issue
occurs while parsing the date string