Class ContactsDatabase


  • public class ContactsDatabase
    extends Object
    simple database for contacts
    Author:
    igor
    • Constructor Detail

      • ContactsDatabase

        public ContactsDatabase​(int count)
        Constructor
        Parameters:
        count - number of contacts to generate at startup
    • Method Detail

      • get

        public Contact get​(long id)
        find contact by id
        Parameters:
        id -
        Returns:
        contact
      • add

        protected void add​(Contact contact)
      • find

        public List<Contact> find​(long first,
                                  long count,
                                  SortParam sort)
        select contacts and apply sort
        Parameters:
        first -
        count -
        sort -
        Returns:
        list of contacts
      • getCount

        public int getCount()
        Returns:
        number of contacts in the database
      • save

        public void save​(Contact contact)
        add contact to the database
        Parameters:
        contact -
      • delete

        public void delete​(Contact contact)
        delete contact from the database
        Parameters:
        contact -