diff options
author | Shawn O. Pearce <spearce@spearce.org> | 2010-04-16 08:41:59 -0700 |
---|---|---|
committer | Shawn O. Pearce <spearce@spearce.org> | 2010-04-16 16:30:21 -0700 |
commit | 4cc7b1c5b0e383ae3d65798e35f759441417fed8 (patch) | |
tree | 7a79c2847d3d0f2d60b439d2228ae92d13f9b683 /org.eclipse.jgit | |
parent | 06ee913c8d5cd1afaa3c5573430f07e5655e1edf (diff) | |
download | jgit-4cc7b1c5b0e383ae3d65798e35f759441417fed8.tar.gz jgit-4cc7b1c5b0e383ae3d65798e35f759441417fed8.zip |
ObjectIdSubclassMap: Add isEmpty() method
This class behaves like a cross between a Set and a Map, sometimes
we might expect to use the method isEmpty() to test for size() == 0.
So implement it, reducing the surprise folks get when they are given
one of these objects.
Change-Id: I0d68e1243da8e62edf79c6ba4fd925f643e80a88
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectIdSubclassMap.java | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectIdSubclassMap.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectIdSubclassMap.java index a0b6d0ed24..aa4bf99f33 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectIdSubclassMap.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectIdSubclassMap.java @@ -135,6 +135,11 @@ public class ObjectIdSubclassMap<V extends ObjectId> implements Iterable<V> { return size; } + /** @return true if {@link #size()} is 0. */ + public boolean isEmpty() { + return size == 0; + } + public Iterator<V> iterator() { return new Iterator<V>() { private int found; |