From 652a6b033428e6c668333bcf2d510332dca1f8c0 Mon Sep 17 00:00:00 2001 From: Shawn Pearce Date: Thu, 20 Jul 2017 01:51:44 -0700 Subject: IntList: support contains(int) LongList supports contains(long). IntList should also support contains(int). Change-Id: Ic7a81c3c25b0f10d92087b56e9f200b676060f63 --- org.eclipse.jgit/src/org/eclipse/jgit/util/IntList.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'org.eclipse.jgit') 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 @@ -70,6 +70,21 @@ public class IntList { return count; } + /** + * 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()}). -- cgit v1.2.3