daily pastebin goal
43%
SHARE
TWEET

Untitled

a guest Nov 14th, 2018 67 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
 
  1. import java.util.*;
  2.  
  3. public class ListPersonDB implements PersonDB {
  4.  
  5.     private List<Person> persons;
  6.     int size;
  7.     public int size (){
  8.         return.person.size();
  9.     }
  10.    
  11.     public ListPersonDB() {
  12.         persons = new ArrayList<Person>();
  13.     }
  14.    
  15.     public boolean insert(Person p) throws PersonException {
  16.        
  17.         return persons.add(p);
  18.     }
  19.    
  20.     public boolean update(Person p) throws PersonException {return true;}
  21.     public boolean insertOrUpdate(Person p) throws PersonException {return true;}
  22.     public boolean delete(String jmbg) throws PersonException {return true;}
  23.    
  24.     public int size() {
  25.        
  26.         return size = persons.size();
  27.     }
  28.     public void clear(){
  29.        
  30.         persons.clear();
  31.     }
  32.    
  33.     public Person findByJmbg(String jmbg) {return null;}
  34.     public Collection<Person> findByName(String name) {return null;}
  35.     public Collection<Person> findByAge(int age) {return null;}
  36.     public Collection<Person> findByGender(Boolean gender) {return null;}
  37.    
  38.     public String toString() {
  39.        
  40.         return persons.toString();
  41.     }
  42.    
  43.     public static void main (String[] args) {
  44.        
  45.         try {
  46.         ListPersonDB db = new ListPersonDB();
  47.         Person p = new Person("Sinan", "Sakic", "19400101800088", 60, false);
  48.         Person p1 = new Person("Jasar", "Ahmedovski", "19400101800088", 60, false);
  49.        
  50.         db.insert(p);
  51.         db.insert(p1);
  52.         //db.update();
  53.         //db.insertOrUpdate();
  54.         //db.delete();
  55.         db.size();
  56.         //db.clear();
  57.         //db.findByJmbg();
  58.         //db.findByName();
  59.         //db.findByAge();
  60.         //db.findByGender();
  61.        
  62.         System.out.println(db);
  63.         System.out.println(db.size);
  64.        
  65.         } catch(Exception e) {
  66.             e.printStackTrace();
  67.         }
  68.     }
  69.    
  70.    
  71.    
  72.    
  73.    
  74. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top