diff options
author | Johannes Schindelin <johannes.schindelin@gmx.de> | 2009-09-03 12:46:31 +0200 |
---|---|---|
committer | Shawn O. Pearce <spearce@spearce.org> | 2009-10-06 07:42:49 -0700 |
commit | 9c056fcace49f4c111cad8a49399a113fb083f30 (patch) | |
tree | ac9ac1851e459649fc31c1341387a561909e9705 /org.eclipse.jgit | |
parent | 6e1571d5b9269ec79eadad0dbd5916508a4fee82 (diff) | |
download | jgit-9c056fcace49f4c111cad8a49399a113fb083f30.tar.gz jgit-9c056fcace49f4c111cad8a49399a113fb083f30.zip |
Add set to IntList
Some applications may wish to modify an int list.
Bug: 291083
Eclipse-CQ: 3559
Change-Id: Iea871443ec661230aec92397229f1eda6c74216f
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
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/util/IntList.java | 18 |
1 files changed, 18 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 510f2a4db9..510032eeb0 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/util/IntList.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/IntList.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2008, Google Inc. + * Copyright (C) 2009, Johannes Schindelin <johannes.schindelin@gmx.de> * and other copyright owners as documented in the project's IP log. * * This program and the accompanying materials are made available @@ -100,6 +101,23 @@ public class IntList { } /** + * Assign an entry in the list. + * + * @param index + * index to set, must be in the range [0, {@link #size()}). + * @param n + * value to store at the position. + */ + public void set(final int index, final int n) { + if (count < index) + throw new ArrayIndexOutOfBoundsException(index); + else if (count == index) + add(n); + else + entries[index] = n; + } + + /** * Pad the list with entries. * * @param toIndex |