Guest User

Untitled

a guest
Jul 17th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.56 KB | None | 0 0
  1. public class Contact implements Comparable<Contact> {
  2.  
  3.     private String firstName;
  4.     private String lastName;
  5.     private String phone;
  6.     private String address;
  7.     private int age;
  8.     private String organization;
  9.     private String group;
  10.  
  11.     public int compareTo(Contact other) {
  12.         return firstName.compareTo(other.firstName);
  13.     }
  14. }
  15.  
  16. ----------------------------------------------------------------
  17.  
  18. // The ArrayList can be declared like this:
  19.  
  20. List<Contact> contacts = new ArrayList<Contact>();
  21.  
  22. // ... At the beginning of execution.
Add Comment
Please, Sign In to add comment