import java.util.Iterator;
import java.util.LinkedList;
-public class Addressbook
- implements EntryConsumer, EntryProducer
+public class Addressbook implements EntryConsumer, EntryProducer
{
- LinkedList<Entry> data_ = new LinkedList<Entry>();
-
- public void add(Entry entry)
- {
- data_.add(entry);
- }
-
- public Iterator<Entry> entries()
- {
- return data_.iterator();
- }
-
- public void consume(Entry entry)
- {
- add(entry);
- }
-
- public void sendTo(EntryConsumer consumer)
- {
- for (Entry entry : data_)
- consumer.consume(entry);
- }
+ LinkedList<Entry> data_ = new LinkedList<Entry>();
+
+ public void add(Entry entry)
+ {
+ data_.add(entry);
+ }
+
+ public Iterator<Entry> entries()
+ {
+ return data_.iterator();
+ }
+
+ public void consume(Entry entry)
+ {
+ add(entry);
+ }
+
+ public void sendTo(EntryConsumer consumer)
+ {
+ for (Entry entry : data_)
+ consumer.consume(entry);
+ }
}