Class UserList

All Implemented Interfaces:
IFilterableByID<User>, IFilterableBySchool<User>, ISerializable, Iterable<User>

public class UserList extends RepositoryList<User> implements IFilterableByID<User>, IFilterableBySchool<User>
The UserList class represents a list of user objects. It extends the RepositoryList class and implements the IFilterableByID and ISerializeable interfaces.
  • Constructor Details

    • UserList

      public UserList(List<User> all)
      Constructs a UserList object with the specified list of users.
      Parameters:
      all - The list of users to be included in the user list.
    • UserList

      public UserList()
      Constructs an empty UserList object.
  • Method Details

    • filterByID

      public UserList filterByID(String id)
      Filters the user list by the specified user ID.
      Specified by:
      filterByID in interface IFilterableByID<User>
      Parameters:
      id - The user ID to filter by.
      Returns:
      A UserList containing users with the specified ID.
    • filterBySchool

      public UserList filterBySchool(String school)
      Description copied from interface: IFilterableBySchool
      Filters the items by school.
      Specified by:
      filterBySchool in interface IFilterableBySchool<User>
      Parameters:
      school - The school to filter by.
      Returns:
      A list of items that were registered on the given school.
    • toArray

      public User[] toArray()
      Converts the user list to an array of users.
      Overrides:
      toArray in class RepositoryList<User>
      Returns:
      An array of users.
    • isEmpty

      public boolean isEmpty()
      Checks if the user list is empty.
      Returns:
      true if the user list is empty, false otherwise.
    • serialize

      public ArrayList<ArrayList<String>> serialize()
      Serializes the user list and represents its data as an ArrayList of ArrayList of Strings.
      Specified by:
      serialize in interface ISerializable
      Returns:
      An ArrayList<ArrayList<String>> representing the serialized data of the user list.