diff options
author | mkoch <mkoch@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-06-17 12:01:37 +0000 |
---|---|---|
committer | mkoch <mkoch@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-06-17 12:01:37 +0000 |
commit | 7a79e0cecdf343311188ca8f6dbd0f2febdb1722 (patch) | |
tree | a37c90d42d2a4afa1f45648bea1ebfadc52f852d /libjava/gnu/java/lang/ArrayHelper.java | |
parent | 174962695e46a1b58d5ab1c568704c545b76bab4 (diff) | |
download | ppe42-gcc-7a79e0cecdf343311188ca8f6dbd0f2febdb1722.tar.gz ppe42-gcc-7a79e0cecdf343311188ca8f6dbd0f2febdb1722.zip |
2003-06-17 Michael Koch <konqueror@gmx.de>
* gnu/java/lang/ArrayHelper.java,
gnu/java/lang/ClassHelper.java:
Reformatted to match classpath's versions.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@68078 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/gnu/java/lang/ArrayHelper.java')
-rw-r--r-- | libjava/gnu/java/lang/ArrayHelper.java | 59 |
1 files changed, 38 insertions, 21 deletions
diff --git a/libjava/gnu/java/lang/ArrayHelper.java b/libjava/gnu/java/lang/ArrayHelper.java index 271e248f523..0216caba167 100644 --- a/libjava/gnu/java/lang/ArrayHelper.java +++ b/libjava/gnu/java/lang/ArrayHelper.java @@ -1,5 +1,5 @@ -/* gnu.java.lang.ArrayHelper - Copyright (C) 1998 Free Software Foundation, Inc. +/* ArrayHelper.java -- Helper methods for handling array operations + Copyright (C) 1998, 2002 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. - + GNU Classpath is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU @@ -39,25 +39,42 @@ exception statement from your version. */ package gnu.java.lang; /** - ** ArrayHelper helps you do things with arrays. - ** - ** @author John Keiser - ** @version 1.1.0, 29 Jul 1998 - **/ - -public class ArrayHelper { - public static boolean contains(Object[] array, Object searchFor) { - return indexOf(array,searchFor) != -1; - } + * ArrayHelper helps you do things with arrays. + * + * @author John Keiser + */ +public class ArrayHelper +{ + /** + * Counterpart to java.util.Collection.contains. + * + * @param array the array to search + * @param searchFor the object to locate + * @return true if some array element <code>equals(searchFor)</code> + */ + public static boolean contains(Object[] array, Object searchFor) + { + return indexOf(array, searchFor) != -1; + } - public static int indexOf(Object[] array, Object searchFor) { - for(int i=0;i<array.length;i++) { - if(array[i].equals(searchFor)) { - return i; - } - } - return -1; - } + /** + * Counterpart to java.util.Collection.indexOf. + * + * @param array the array to search + * @param searchFor the object to locate + * @return the index of the first equal object, or -1 + */ + public static int indexOf(Object[] array, Object searchFor) + { + for (int i = 0; i < array.length; i++) + { + if(array[i].equals(searchFor)) + { + return i; + } + } + return -1; + } public static boolean equalsArray(Object[] a, Object[] b) { if(a.length == b.length) { |