From 4cc7b1c5b0e383ae3d65798e35f759441417fed8 Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Fri, 16 Apr 2010 08:41:59 -0700 Subject: [PATCH] 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 --- .../src/org/eclipse/jgit/lib/ObjectIdSubclassMap.java | 5 +++++ 1 file changed, 5 insertions(+) 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 a0b6d0ed2..aa4bf99f3 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 implements Iterable { return size; } + /** @return true if {@link #size()} is 0. */ + public boolean isEmpty() { + return size == 0; + } + public Iterator iterator() { return new Iterator() { private int found;