ソースを参照

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>
tags/v0.8.1
Shawn O. Pearce 14年前
コミット
4cc7b1c5b0
1個のファイルの変更5行の追加0行の削除
  1. 5
    0
      org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectIdSubclassMap.java

+ 5
- 0
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;

読み込み中…
キャンセル
保存