public class Contacts
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
ACTION_ADD_CONTACT
new contact added
|
static int |
ACTION_CHANGE_CONTACT
properties of some contact changed
|
static int |
ACTION_CLEAR_CONTACTS
all contacts removed
|
static int |
ACTION_REMOVE_CONTACT
existing contact removed
|
Modifier and Type | Method and Description |
---|---|
boolean |
add(Contact contact)
Add new contact
|
void |
addActionListener(java.awt.event.ActionListener actionListener) |
boolean |
addAll(java.util.Collection<Contact> contacts)
Add new contacts
|
void |
clear()
Remove all contacts
|
boolean |
contains(Contact contact)
Search for an existing contact
|
java.util.SortedSet<Contact> |
getAll()
Get unmodifiable collection of all contacts sorted by name
|
static Contacts |
getInstance()
Get shared instance
|
boolean |
isEmpty()
Return if there are no contacts
|
boolean |
remove(Contact contact)
Remove existing contact
|
void |
removeActionListener(java.awt.event.ActionListener actionListener) |
boolean |
removeAll(java.util.Collection<Contact> contacts)
Remove existing contacts
|
int |
size()
Return number of contacts
|
public static final int ACTION_ADD_CONTACT
public static final int ACTION_REMOVE_CONTACT
public static final int ACTION_CLEAR_CONTACTS
public static final int ACTION_CHANGE_CONTACT
public void addActionListener(java.awt.event.ActionListener actionListener)
public void removeActionListener(java.awt.event.ActionListener actionListener)
public static Contacts getInstance()
public java.util.SortedSet<Contact> getAll()
public boolean add(Contact contact)
contact
- new contact, not nullCollection.add(E)
public boolean addAll(java.util.Collection<Contact> contacts)
contacts
- collection of contacts, not nullCollection.addAll(java.util.Collection<? extends E>)
public boolean remove(Contact contact)
contact
- contact to be removed, not nullCollection.remove(java.lang.Object)
public boolean removeAll(java.util.Collection<Contact> contacts)
contacts
- collection of contacts to be removed, not nullCollection.removeAll(java.util.Collection<?>)
public void clear()
public boolean contains(Contact contact)
contact
- contact to be searched, not nullCollection.contains(java.lang.Object)
public int size()
Collection.size()
public boolean isEmpty()
Collection.isEmpty()