站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > JBoss RULES 4.0.0.11754MR2 API 英文版文档

ArrayUtils (Drools 4.0.0.11754MR2 API) - JBoss RULES 4.0.0.11754MR2 API 英文版文档


org.drools.util
Class ArrayUtils

java.lang.Object
  extended by org.drools.util.ArrayUtils

public class ArrayUtils
extends Object

Taken from commons lang

Operations on arrays, primitive arrays (like int[]) and primitive wrapper arrays (like Integer[]).

This class tries to handle null input gracefully. An exception will not be thrown for a null array input. However, an Object array that contains a null element may throw an exception. Each method documents its behaviour.

Since:
2.0
Version:
$Id$
Author:
Stephen Colebourne, Moritz Petersen, Fredrik Westermarck, Nikolay Metchev, Matthew Hawthorne, Tim O'Brien, Pete Gieser, Gary Gregory, Ashwin S, Maarten Coene

Field Summary
static int INDEX_NOT_FOUND
           
 
Constructor Summary
ArrayUtils()
           
 
Method Summary
static boolean contains(Object[] array, Object objectToFind)
          Checks if the object is in the given array.
static int indexOf(Object[] array, Object objectToFind)
          Finds the index of the given object in the array.
static int indexOf(Object[] array, Object objectToFind, int startIndex)
          Finds the index of the given object in the array starting at the given index.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INDEX_NOT_FOUND

public static final int INDEX_NOT_FOUND
See Also:
Constant Field Values
Constructor Detail

ArrayUtils

public ArrayUtils()
Method Detail

contains

public static boolean contains(Object[] array,
                               Object objectToFind)

Checks if the object is in the given array.

The method returns false if a null array is passed in.

Parameters:
array - the array to search through
objectToFind - the object to find
Returns:
true if the array contains the object

indexOf

public static int indexOf(Object[] array,
                          Object objectToFind)

Finds the index of the given object in the array.

This method returns INDEX_NOT_FOUND (-1) for a null input array.

Parameters:
array - the array to search through for the object, may be null
objectToFind - the object to find, may be null
Returns:
the index of the object within the array, INDEX_NOT_FOUND (-1) if not found or null array input

indexOf

public static int indexOf(Object[] array,
                          Object objectToFind,
                          int startIndex)

Finds the index of the given object in the array starting at the given index.

This method returns INDEX_NOT_FOUND (-1) for a null input array.

A negative startIndex is treated as zero. A startIndex larger than the array length will return INDEX_NOT_FOUND (-1).

Parameters:
array - the array to search through for the object, may be null
objectToFind - the object to find, may be null
startIndex - the index to start searching at
Returns:
the index of the object within the array starting at the index, INDEX_NOT_FOUND (-1) if not found or null array input


Copyright © 2001-2007 JBoss Inc.. All Rights Reserved.