public final class AttachmentSetImpl extends Object implements AttachmentSet
AttachmentSet
implementation backed by ArrayList
.
The assumption here is that the number of attachments are small enough to
justify linear search in get(String)
.
Constructor and Description |
---|
AttachmentSetImpl()
Creates an empty
AttachmentSet . |
AttachmentSetImpl(Iterable<Attachment> base)
Creates an
AttachmentSet by copying contents from another. |
Modifier and Type | Method and Description |
---|---|
void |
add(Attachment att)
Adds an attachment to this set.
|
Attachment |
get(String contentId)
Gets the attachment by the content ID.
|
boolean |
isEmpty()
Returns true if there's no attachment.
|
Iterator<Attachment> |
iterator() |
public AttachmentSetImpl()
AttachmentSet
.public AttachmentSetImpl(Iterable<Attachment> base)
AttachmentSet
by copying contents from another.public Attachment get(String contentId)
AttachmentSet
get
in interface AttachmentSet
contentId
- The content ID like "foo-bar-zot@abc.com", without
surrounding '<' and '>' used as the transfer syntax.public boolean isEmpty()
AttachmentSet
isEmpty
in interface AttachmentSet
public void add(Attachment att)
AttachmentSet
Note that it's OK for an Attachment
to belong to
more than one AttachmentSet
(which is in fact
necessary when you wrap a Message
into another.
add
in interface AttachmentSet
att
- must not be null.public Iterator<Attachment> iterator()
iterator
in interface Iterable<Attachment>
Copyright (c) 1997-2012 Oracle and/or its affiliates. All rights reserved.