diff options
author | Shawn Pearce <spearce@spearce.org> | 2017-07-20 01:51:44 -0700 |
---|---|---|
committer | Shawn Pearce <spearce@spearce.org> | 2017-07-28 10:18:27 -0700 |
commit | 652a6b033428e6c668333bcf2d510332dca1f8c0 (patch) | |
tree | df6386deb28997ce271ee80ac2588926f98ad400 /org.eclipse.jgit | |
parent | ad269ae426fcfcb5884830cd3726385272aea1d1 (diff) | |
download | jgit-652a6b033428e6c668333bcf2d510332dca1f8c0.tar.gz jgit-652a6b033428e6c668333bcf2d510332dca1f8c0.zip |
IntList: support contains(int)
LongList supports contains(long).
IntList should also support contains(int).
Change-Id: Ic7a81c3c25b0f10d92087b56e9f200b676060f63
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/util/IntList.java | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/IntList.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/IntList.java index 658dd06d46..0a3c846a0e 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/util/IntList.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/IntList.java @@ -71,6 +71,21 @@ public class IntList { } /** + * Check if an entry appears in this collection. + * + * @param value + * the value to search for. + * @return true of {@code value} appears in this list. + * @since 4.9 + */ + public boolean contains(int value) { + for (int i = 0; i < count; i++) + if (entries[i] == value) + return true; + return false; + } + + /** * @param i * index to read, must be in the range [0, {@link #size()}). * @return the number at the specified index |