|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectpapaya.Find
public final class Find
Static class for finding indices in an array corresponding to a given value/object.
(Portions of this code were (conveniently!) copied and pasted from commons.apache.org.) :)
Field Summary |
---|
Fields inherited from interface papaya.PapayaConstants |
---|
BASELINE, big, biginv, BOTTOM, CENTER, CORNER, FONTNAME, GRAY, INDEX_NOT_FOUND, INDICES_NOT_FOUND, LEFT, LOGPI, MACHEP, MAXGAM, MAXLOG, MINLOG, RIGHT, SQRTH, SQTPI, STROKEWEIGHT, TEXTSIZE, TOP |
Method Summary | |
---|---|
static boolean |
contains(byte[] array,
byte valueToFind)
Checks if the value is in the given array. |
static boolean |
contains(char[] array,
char valueToFind)
Checks if the value is in the given array. |
static boolean |
contains(double[] array,
double valueToFind)
Checks if the value is in the given array. |
static boolean |
contains(double[] array,
double valueToFind,
double tolerance)
Checks if a value falling within the given tolerance is in the given array. |
static boolean |
contains(float[] array,
float valueToFind)
Checks if the value is in the given array. |
static boolean |
contains(int[] array,
int valueToFind)
Checks if the value is in the given array. |
static boolean |
contains(long[] array,
long valueToFind)
Checks if the value is in the given array. |
static boolean |
contains(Object[] array,
Object objectToFind)
Checks if the object is in the given array. |
static boolean |
contains(short[] array,
short valueToFind)
Checks if the value is in the given array. |
static int |
indexOf(boolean[] array,
boolean valueToFind)
Finds the index of the given value in the array. |
static int |
indexOf(boolean[] array,
boolean valueToFind,
int startIndex)
Finds the index of the given value in the array starting at the given index. |
static int |
indexOf(byte[] array,
byte valueToFind)
Finds the index of the given value in the array. |
static int |
indexOf(byte[] array,
byte valueToFind,
int startIndex)
Finds the index of the given value in the array starting at the given index. |
static int |
indexOf(char[] array,
char valueToFind)
Finds the index of the given value in the array. |
static int |
indexOf(char[] array,
char valueToFind,
int startIndex)
Finds the index of the given value in the array starting at the given index. |
static int |
indexOf(double[] array,
double valueToFind)
Finds the index of the given value in the array. |
static int |
indexOf(double[] array,
double valueToFind,
double tolerance)
Finds the index of the given value within a given tolerance in the array. |
static int |
indexOf(double[] array,
double valueToFind,
int startIndex)
Finds the index of the given value in the array starting at the given index. |
static int |
indexOf(double[] array,
double valueToFind,
int startIndex,
double tolerance)
Finds the index of the given value in the array starting at the given index. |
static int |
indexOf(float[] array,
float valueToFind)
Finds the index of the given value in the array. |
static int |
indexOf(float[] array,
float valueToFind,
int startIndex)
Finds the index of the given value in the array starting at the given index. |
static int |
indexOf(int[] array,
int valueToFind)
Finds the index of the given value in the array. |
static int |
indexOf(int[] array,
int valueToFind,
int startIndex)
Finds the index of the given value in the array starting at the given index. |
static int |
indexOf(long[] array,
long valueToFind)
Finds the index of the given value in the array. |
static int |
indexOf(long[] array,
long valueToFind,
int startIndex)
Finds the index of the given value in the array starting at the given index. |
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. |
static int |
indexOf(short[] array,
short valueToFind)
Finds the index of the given value in the array. |
static int |
indexOf(short[] array,
short valueToFind,
int startIndex)
Finds the index of the given value in the array starting at the given index. |
static int[] |
indicesGreaterThan(float[] array,
float valueOfMin)
|
static int[] |
indicesGreaterThan(int[] array,
int valueOfMin)
|
static int[] |
indicesGreaterThanOrEqualTo(float[] array,
float valueOfMin)
|
static int[] |
indicesGreaterThanOrEqualTo(int[] array,
int valueOfMin)
|
static int[] |
indicesLessThan(float[] array,
float valueOfMax)
|
static int[] |
indicesLessThan(int[] array,
int valueOfMax)
|
static int[] |
indicesLessThanOrEqualTo(float[] array,
float valueOfMax)
|
static int[] |
indicesLessThanOrEqualTo(int[] array,
int valueOfMax)
|
static int[] |
indicesWith(boolean[] array,
boolean valueToFind)
Finds the indices containing the specified value in the array. |
static int[] |
indicesWith(boolean[] array,
boolean valueToFind,
int startIndex)
Finds the indices containing the specified value in the array. |
static int[] |
indicesWith(byte[] array,
byte valueToFind)
Finds the indices containing the specified value in the array. |
static int[] |
indicesWith(byte[] array,
byte valueToFind,
int startIndex)
Finds the indices containing the specified value in the array. |
static int[] |
indicesWith(char[] array,
char valueToFind)
Finds the indices containing the specified value in the array. |
static int[] |
indicesWith(char[] array,
char valueToFind,
int startIndex)
Finds the indices containing the specified value in the array. |
static int[] |
indicesWith(double[] array,
double valueToFind)
Finds the indices containing the specified value in the array. |
static int[] |
indicesWith(double[] array,
double valueToFind,
int startIndex)
Finds the indices containing the specified value in the array. |
static int[] |
indicesWith(float[] array,
float valueToFind)
Finds the indices containing the specified value in the array. |
static int[] |
indicesWith(float[] array,
float valueToFind,
int startIndex)
Finds the indices containing the specified value in the array. |
static int[] |
indicesWith(int[] array,
int valueToFind)
Finds the indices containing the specified value in the array. |
static int[] |
indicesWith(int[] array,
int valueToFind,
int startIndex)
Finds the indices containing the specified value in the array. |
static int[] |
indicesWith(long[] array,
long valueToFind)
Finds the indices containing the specified value in the array. |
static int[] |
indicesWith(long[] array,
long valueToFind,
int startIndex)
Finds the indices containing the specified value in the array. |
static int[] |
indicesWith(Object[] array,
Object objectToFind)
Finds the indices containing the specified object in the array. |
static int[] |
indicesWith(Object[] array,
Object objectToFind,
int startIndex)
Finds the indices containing the specified object in the array. |
static int[] |
indicesWith(short[] array,
short valueToFind)
Finds the indices containing the specified value in the array. |
static int[] |
indicesWith(short[] array,
short valueToFind,
int startIndex)
Finds the indices containing the specified value in the array. |
static int[] |
indicesWithin(float[] array,
float minVal,
float maxVal)
Finds the indices for the array elements within the min and max value (inclusive). |
static int[] |
indicesWithin(int[] array,
float minVal,
float maxVal)
Finds the indices for the array elements within the min and max value (inclusive). |
static int |
lastIndexOf(boolean[] array,
boolean valueToFind)
Finds the last index of the given value within the array. |
static int |
lastIndexOf(boolean[] array,
boolean valueToFind,
int startIndex)
Finds the last index of the given value in the array starting at the given index. |
static int |
lastIndexOf(byte[] array,
byte valueToFind)
Finds the last index of the given value within the array. |
static int |
lastIndexOf(byte[] array,
byte valueToFind,
int startIndex)
Finds the last index of the given value in the array starting at the given index. |
static int |
lastIndexOf(char[] array,
char valueToFind)
Finds the last index of the given value within the array. |
static int |
lastIndexOf(char[] array,
char valueToFind,
int startIndex)
Finds the last index of the given value in the array starting at the given index. |
static int |
lastIndexOf(double[] array,
double valueToFind)
Finds the last index of the given value within the array. |
static int |
lastIndexOf(double[] array,
double valueToFind,
double tolerance)
Finds the last index of the given value within a given tolerance in the array. |
static int |
lastIndexOf(double[] array,
double valueToFind,
int startIndex)
Finds the last index of the given value in the array starting at the given index. |
static int |
lastIndexOf(double[] array,
double valueToFind,
int startIndex,
double tolerance)
Finds the last index of the given value in the array starting at the given index. |
static int |
lastIndexOf(float[] array,
float valueToFind)
Finds the last index of the given value within the array. |
static int |
lastIndexOf(float[] array,
float valueToFind,
int startIndex)
Finds the last index of the given value in the array starting at the given index. |
static int |
lastIndexOf(int[] array,
int valueToFind)
Finds the last index of the given value within the array. |
static int |
lastIndexOf(int[] array,
int valueToFind,
int startIndex)
Finds the last index of the given value in the array starting at the given index. |
static int |
lastIndexOf(long[] array,
long valueToFind)
Finds the last index of the given value within the array. |
static int |
lastIndexOf(long[] array,
long valueToFind,
int startIndex)
Finds the last index of the given value in the array starting at the given index. |
static int |
lastIndexOf(Object[] array,
Object objectToFind)
Finds the last index of the given object within the array. |
static int |
lastIndexOf(Object[] array,
Object objectToFind,
int startIndex)
Finds the last index of the given object in the array starting at the given index. |
static int |
lastIndexOf(short[] array,
short valueToFind)
Finds the last index of the given value within the array. |
static int |
lastIndexOf(short[] array,
short valueToFind,
int startIndex)
Finds the last index of the given value in the array starting at the given index. |
static int |
numGreaterThan(float[] array,
float valueOfMin)
Finds the number of elements strictly greater than the specified value. |
static int |
numGreaterThan(int[] array,
int valueOfMin)
Finds the number of elements strictly greater than the specified value. |
static int |
numGreaterThanOrEqualTo(float[] array,
float valueOfMin)
Finds the number of elements greater than or equal to the specified value. |
static int |
numGreaterThanOrEqualTo(int[] array,
int valueOfMin)
Finds the number of elements greater than or equal to the specified value. |
static int |
numLessThan(float[] array,
float valueOfMax)
Finds the number of elements strictly less than the specified value. |
static int |
numLessThan(int[] array,
int valueOfMax)
Finds the number of elements strictly less than the specified value. |
static int |
numLessThanOrEqualTo(float[] array,
float valueOfMax)
Finds the number of elements less than or equal to the specified value. |
static int |
numLessThanOrEqualTo(int[] array,
int valueOfMax)
Finds the number of elements less than or equal to the specified value. |
static int |
numRepeats(boolean[] array,
boolean valueToFind)
Finds the number of times a given value/object is present in an array. |
static int |
numRepeats(byte[] array,
byte valueToFind)
Finds the number of times a given value/object is present in an array. |
static int |
numRepeats(char[] array,
char valueToFind)
Finds the number of times a given value/object is present in an array. |
static int |
numRepeats(double[] array,
double valueToFind)
Finds the number of times a given value/object is present in an array. |
static int |
numRepeats(float[] array,
float valueToFind)
Finds the number of times a given value/object is present in an array. |
static int |
numRepeats(int[] array,
int valueToFind)
Finds the number of times a given value/object is present in an array. |
static int |
numRepeats(long[] array,
long valueToFind)
Finds the number of times a given value/object is present in an array. |
static int |
numRepeats(Object[] array,
Object objectToFind)
Finds the number of times a given value/object is present in an array. |
static int |
numRepeats(short[] array,
short valueToFind)
Finds the number of times a given value/object is present in an array. |
static float[] |
uniqueElems(float[] array)
Find the unique elements in a float array (uses HashSets) |
static int[] |
uniqueElems(int[] array)
Find the unique elements in a int array (uses HashSets) |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static int indexOf(Object[] array, Object objectToFind)
Finds the index of the given object in the array.
This method returns PapayaConstants.INDEX_NOT_FOUND
(-1
) for a null
input array.
array
- the array to search through for the object, may be null
objectToFind
- the object to find, may be null
PapayaConstants.INDEX_NOT_FOUND
(-1
) if not found or null
array inputpublic 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 PapayaConstants.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 PapayaConstants.INDEX_NOT_FOUND
(-1
).
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
PapayaConstants.INDEX_NOT_FOUND
(-1
) if not found or null
array inputpublic static int lastIndexOf(Object[] array, Object objectToFind)
Finds the last index of the given object within the array.
This method returns PapayaConstants.INDEX_NOT_FOUND
(-1
) for a null
input array.
array
- the array to travers backwords looking for the object, may be null
objectToFind
- the object to find, may be null
PapayaConstants.INDEX_NOT_FOUND
(-1
) if not found or null
array inputpublic static int lastIndexOf(Object[] array, Object objectToFind, int startIndex)
Finds the last index of the given object in the array starting at the given index.
This method returns PapayaConstants.INDEX_NOT_FOUND
(-1
) for a null
input array.
A negative startIndex will return PapayaConstants.INDEX_NOT_FOUND
(-1
). A startIndex larger than
the array length will search from the end of the array.
array
- the array to traverse for looking for the object, may be null
objectToFind
- the object to find, may be null
startIndex
- the start index to travers backwards from
PapayaConstants.INDEX_NOT_FOUND
(-1
) if not found or null
array inputpublic 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.
array
- the array to search throughobjectToFind
- the object to find
true
if the array contains the objectpublic static int[] indicesWith(Object[] array, Object objectToFind)
Finds the indices containing the specified object in the array.
This method returns PapayaConstants.INDICES_NOT_FOUND
(int[] = -1
) for a null
input array.
array
- the array to search through for the object to find, may be null
objectToFind
- the object to find
PapayaConstants.INDICES_NOT_FOUND
(int[] = -1
) if not found or null
array inputpublic static int[] indicesWith(Object[] array, Object objectToFind, int startIndex)
Finds the indices containing the specified object in the array.
This method returns PapayaConstants.INDICES_NOT_FOUND
(int[] = -1
) for a null
input array.
array
- the array to search through for the object to find, may be null
objectToFind
- the object to findstartIndex
- the index to start searching at
PapayaConstants.INDICES_NOT_FOUND
(int[] = -1
) if not found or null
array inputpublic static int numRepeats(Object[] array, Object objectToFind)
Finds the number of times a given value/object is present in an array.
array
- the array to search through for the value/objectobjectToFind
- the object to find.
PapayaConstants.INDEX_NOT_FOUND
(-1
) if not found or null
array inputpublic static int indexOf(long[] array, long valueToFind)
Finds the index of the given value in the array.
This method returns PapayaConstants.INDEX_NOT_FOUND
(-1
) for a null
input array.
array
- the array to search through for the object, may be null
valueToFind
- the value to find
PapayaConstants.INDEX_NOT_FOUND
(-1
) if not found or null
array inputpublic static int indexOf(long[] array, long valueToFind, int startIndex)
Finds the index of the given value in the array starting at the given index.
This method returns PapayaConstants.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 PapayaConstants.INDEX_NOT_FOUND
(-1
).
array
- the array to search through for the object, may be null
valueToFind
- the value to findstartIndex
- the index to start searching at
PapayaConstants.INDEX_NOT_FOUND
(-1
) if not found or null
array inputpublic static int lastIndexOf(long[] array, long valueToFind)
Finds the last index of the given value within the array.
This method returns PapayaConstants.INDEX_NOT_FOUND
(-1
) for a null
input array.
array
- the array to travers backwords looking for the object, may be null
valueToFind
- the object to find
PapayaConstants.INDEX_NOT_FOUND
(-1
) if not found or null
array inputpublic static int lastIndexOf(long[] array, long valueToFind, int startIndex)
Finds the last index of the given value in the array starting at the given index.
This method returns PapayaConstants.INDEX_NOT_FOUND
(-1
) for a null
input array.
A negative startIndex will return PapayaConstants.INDEX_NOT_FOUND
(-1
). A startIndex larger than the
array length will search from the end of the array.
array
- the array to traverse for looking for the object, may be null
valueToFind
- the value to findstartIndex
- the start index to travers backwards from
PapayaConstants.INDEX_NOT_FOUND
(-1
) if not found or null
array inputpublic static boolean contains(long[] array, long valueToFind)
Checks if the value is in the given array.
The method returns false
if a null
array is passed in.
array
- the array to search throughvalueToFind
- the value to find
true
if the array contains the objectpublic static int[] indicesWith(long[] array, long valueToFind)
Finds the indices containing the specified value in the array.
This method returns PapayaConstants.INDICES_NOT_FOUND
(int[] = -1
) for a null
input array.
array
- the array to search through for the value to find, may be null
valueToFind
- the value to find
PapayaConstants.INDICES_NOT_FOUND
(int[] = -1
) if not found or null
array inputpublic static int[] indicesWith(long[] array, long valueToFind, int startIndex)
Finds the indices containing the specified value in the array.
This method returns PapayaConstants.INDICES_NOT_FOUND
(int[] = -1
) for a null
input array.
array
- the array to search through for the value to find, may be null
valueToFind
- the value to findstartIndex
- the index to start searching at
PapayaConstants.INDICES_NOT_FOUND
(int[] = -1
) if not found or null
array inputpublic static int numRepeats(long[] array, long valueToFind)
Finds the number of times a given value/object is present in an array.
array
- the array to search through for the value/objectvalueToFind
- the object to find.
PapayaConstants.INDEX_NOT_FOUND
(-1
) if not found or null
array inputpublic static int indexOf(int[] array, int valueToFind)
Finds the index of the given value in the array.
This method returns PapayaConstants.INDEX_NOT_FOUND
(-1
) for a null
input array.
array
- the array to search through for the object, may be null
valueToFind
- the value to find
PapayaConstants.INDEX_NOT_FOUND
(-1
) if not found or null
array inputpublic static int indexOf(int[] array, int valueToFind, int startIndex)
Finds the index of the given value in the array starting at the given index.
This method returns PapayaConstants.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 PapayaConstants.INDEX_NOT_FOUND
(-1
).
array
- the array to search through for the object, may be null
valueToFind
- the value to findstartIndex
- the index to start searching at
PapayaConstants.INDEX_NOT_FOUND
(-1
) if not found or null
array inputpublic static int lastIndexOf(int[] array, int valueToFind)
Finds the last index of the given value within the array.
This method returns PapayaConstants.INDEX_NOT_FOUND
(-1
) for a null
input array.
array
- the array to travers backwords looking for the object, may be null
valueToFind
- the object to find
PapayaConstants.INDEX_NOT_FOUND
(-1
) if not found or null
array inputpublic static int lastIndexOf(int[] array, int valueToFind, int startIndex)
Finds the last index of the given value in the array starting at the given index.
This method returns PapayaConstants.INDEX_NOT_FOUND
(-1
) for a null
input array.
A negative startIndex will return PapayaConstants.INDEX_NOT_FOUND
(-1
). A startIndex larger than the
array length will search from the end of the array.
array
- the array to traverse for looking for the object, may be null
valueToFind
- the value to findstartIndex
- the start index to travers backwards from
PapayaConstants.INDEX_NOT_FOUND
(-1
) if not found or null
array inputpublic static boolean contains(int[] array, int valueToFind)
Checks if the value is in the given array.
The method returns false
if a null
array is passed in.
array
- the array to search throughvalueToFind
- the value to find
true
if the array contains the objectpublic static int[] indicesWith(int[] array, int valueToFind)
Finds the indices containing the specified value in the array.
This method returns PapayaConstants.INDICES_NOT_FOUND
(int[] = -1
) for a null
input array.
array
- the array to search through for the value to find, may be null
valueToFind
- the value to find
PapayaConstants.INDICES_NOT_FOUND
(int[] = -1
) if not found or null
array inputpublic static int[] indicesWith(int[] array, int valueToFind, int startIndex)
Finds the indices containing the specified value in the array.
This method returns PapayaConstants.INDICES_NOT_FOUND
(int[] = -1
) for a null
input array.
array
- the array to search through for the value to find, may be null
valueToFind
- the value to findstartIndex
- the index to start searching at
PapayaConstants.INDICES_NOT_FOUND
(int[] = -1
) if not found or null
array inputpublic static int[] indicesWithin(int[] array, float minVal, float maxVal)
Finds the indices for the array elements within the min and max value (inclusive).
This method returns PapayaConstants.INDICES_NOT_FOUND
(int[] = -1
) for a null
input array.
public static int[] indicesLessThanOrEqualTo(int[] array, int valueOfMax)
public static int[] indicesLessThan(int[] array, int valueOfMax)
public static int[] indicesGreaterThanOrEqualTo(int[] array, int valueOfMin)
public static int[] indicesGreaterThan(int[] array, int valueOfMin)
public static int numRepeats(int[] array, int valueToFind)
Finds the number of times a given value/object is present in an array.
array
- the array to search through for the value/objectvalueToFind
- the object to find.
PapayaConstants.INDEX_NOT_FOUND
(-1
) if not found or null
array inputpublic static int numLessThanOrEqualTo(int[] array, int valueOfMax)
Finds the number of elements less than or equal to the specified value.
array
- the array to search through for the value/objectvalueOfMax
- the maximum value
public static int numLessThan(int[] array, int valueOfMax)
Finds the number of elements strictly less than the specified value.
array
- the array to search through for the value/objectvalueOfMax
- the maximum value
public static int numGreaterThanOrEqualTo(int[] array, int valueOfMin)
Finds the number of elements greater than or equal to the specified value.
array
- the array to search through for the value/objectvalueOfMax
- the maximum value
public static int numGreaterThan(int[] array, int valueOfMin)
Finds the number of elements strictly greater than the specified value.
array
- the array to search through for the value/objectvalueOfMax
- the maximum value
public static int[] uniqueElems(int[] array)
public static int indexOf(short[] array, short valueToFind)
Finds the index of the given value in the array.
This method returns PapayaConstants.INDEX_NOT_FOUND
(-1
) for a null
input array.
array
- the array to search through for the object, may be null
valueToFind
- the value to find
PapayaConstants.INDEX_NOT_FOUND
(-1
) if not found or null
array inputpublic static int indexOf(short[] array, short valueToFind, int startIndex)
Finds the index of the given value in the array starting at the given index.
This method returns PapayaConstants.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 PapayaConstants.INDEX_NOT_FOUND
(-1
).
array
- the array to search through for the object, may be null
valueToFind
- the value to findstartIndex
- the index to start searching at
PapayaConstants.INDEX_NOT_FOUND
(-1
) if not found or null
array inputpublic static int lastIndexOf(short[] array, short valueToFind)
Finds the last index of the given value within the array.
This method returns PapayaConstants.INDEX_NOT_FOUND
(-1
) for a null
input array.
array
- the array to travers backwords looking for the object, may be null
valueToFind
- the object to find
PapayaConstants.INDEX_NOT_FOUND
(-1
) if not found or null
array inputpublic static int lastIndexOf(short[] array, short valueToFind, int startIndex)
Finds the last index of the given value in the array starting at the given index.
This method returns PapayaConstants.INDEX_NOT_FOUND
(-1
) for a null
input array.
A negative startIndex will return PapayaConstants.INDEX_NOT_FOUND
(-1
). A startIndex larger than the
array length will search from the end of the array.
array
- the array to traverse for looking for the object, may be null
valueToFind
- the value to findstartIndex
- the start index to travers backwards from
PapayaConstants.INDEX_NOT_FOUND
(-1
) if not found or null
array inputpublic static boolean contains(short[] array, short valueToFind)
Checks if the value is in the given array.
The method returns false
if a null
array is passed in.
array
- the array to search throughvalueToFind
- the value to find
true
if the array contains the objectpublic static int[] indicesWith(short[] array, short valueToFind)
Finds the indices containing the specified value in the array.
This method returns PapayaConstants.INDICES_NOT_FOUND
(int[] = -1
) for a null
input array.
array
- the array to search through for the value to find, may be null
valueToFind
- the value to find
PapayaConstants.INDICES_NOT_FOUND
(int[] = -1
) if not found or null
array inputpublic static int[] indicesWith(short[] array, short valueToFind, int startIndex)
Finds the indices containing the specified value in the array.
This method returns PapayaConstants.INDICES_NOT_FOUND
(int[] = -1
) for a null
input array.
array
- the array to search through for the value to find, may be null
valueToFind
- the value to findstartIndex
- the index to start searching at
PapayaConstants.INDICES_NOT_FOUND
(int[] = -1
) if not found or null
array inputpublic static int numRepeats(short[] array, short valueToFind)
Finds the number of times a given value/object is present in an array.
array
- the array to search through for the value/objectvalueToFind
- the object to find.
PapayaConstants.INDEX_NOT_FOUND
(-1
) if not found or null
array inputpublic static int indexOf(char[] array, char valueToFind)
Finds the index of the given value in the array.
This method returns PapayaConstants.INDEX_NOT_FOUND
(-1
) for a null
input array.
array
- the array to search through for the object, may be null
valueToFind
- the value to find
PapayaConstants.INDEX_NOT_FOUND
(-1
) if not found or null
array inputpublic static int indexOf(char[] array, char valueToFind, int startIndex)
Finds the index of the given value in the array starting at the given index.
This method returns PapayaConstants.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 PapayaConstants.INDEX_NOT_FOUND
(-1
).
array
- the array to search through for the object, may be null
valueToFind
- the value to findstartIndex
- the index to start searching at
PapayaConstants.INDEX_NOT_FOUND
(-1
) if not found or null
array inputpublic static int lastIndexOf(char[] array, char valueToFind)
Finds the last index of the given value within the array.
This method returns PapayaConstants.INDEX_NOT_FOUND
(-1
) for a null
input array.
array
- the array to travers backwords looking for the object, may be null
valueToFind
- the object to find
PapayaConstants.INDEX_NOT_FOUND
(-1
) if not found or null
array inputpublic static int lastIndexOf(char[] array, char valueToFind, int startIndex)
Finds the last index of the given value in the array starting at the given index.
This method returns PapayaConstants.INDEX_NOT_FOUND
(-1
) for a null
input array.
A negative startIndex will return PapayaConstants.INDEX_NOT_FOUND
(-1
). A startIndex larger than the
array length will search from the end of the array.
array
- the array to traverse for looking for the object, may be null
valueToFind
- the value to findstartIndex
- the start index to travers backwards from
PapayaConstants.INDEX_NOT_FOUND
(-1
) if not found or null
array inputpublic static boolean contains(char[] array, char valueToFind)
Checks if the value is in the given array.
The method returns false
if a null
array is passed in.
array
- the array to search throughvalueToFind
- the value to find
true
if the array contains the objectpublic static int[] indicesWith(char[] array, char valueToFind)
Finds the indices containing the specified value in the array.
This method returns PapayaConstants.INDICES_NOT_FOUND
(int[] = -1
) for a null
input array.
array
- the array to search through for the value to find, may be null
valueToFind
- the value to find
PapayaConstants.INDICES_NOT_FOUND
(int[] = -1
) if not found or null
array inputpublic static int[] indicesWith(char[] array, char valueToFind, int startIndex)
Finds the indices containing the specified value in the array.
This method returns PapayaConstants.INDICES_NOT_FOUND
(int[] = -1
) for a null
input array.
array
- the array to search through for the value to find, may be null
valueToFind
- the value to findstartIndex
- the index to start searching at
PapayaConstants.INDICES_NOT_FOUND
(int[] = -1
) if not found or null
array inputpublic static int numRepeats(char[] array, char valueToFind)
Finds the number of times a given value/object is present in an array.
array
- the array to search through for the value/objectvalueToFind
- the object to find.
PapayaConstants.INDEX_NOT_FOUND
(-1
) if not found or null
array inputpublic static int indexOf(byte[] array, byte valueToFind)
Finds the index of the given value in the array.
This method returns PapayaConstants.INDEX_NOT_FOUND
(-1
) for a null
input array.
array
- the array to search through for the object, may be null
valueToFind
- the value to find
PapayaConstants.INDEX_NOT_FOUND
(-1
) if not found or null
array inputpublic static int indexOf(byte[] array, byte valueToFind, int startIndex)
Finds the index of the given value in the array starting at the given index.
This method returns PapayaConstants.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 PapayaConstants.INDEX_NOT_FOUND
(-1
).
array
- the array to search through for the object, may be null
valueToFind
- the value to findstartIndex
- the index to start searching at
PapayaConstants.INDEX_NOT_FOUND
(-1
) if not found or null
array inputpublic static int lastIndexOf(byte[] array, byte valueToFind)
Finds the last index of the given value within the array.
This method returns PapayaConstants.INDEX_NOT_FOUND
(-1
) for a null
input array.
array
- the array to travers backwords looking for the object, may be null
valueToFind
- the object to find
PapayaConstants.INDEX_NOT_FOUND
(-1
) if not found or null
array inputpublic static int lastIndexOf(byte[] array, byte valueToFind, int startIndex)
Finds the last index of the given value in the array starting at the given index.
This method returns PapayaConstants.INDEX_NOT_FOUND
(-1
) for a null
input array.
A negative startIndex will return PapayaConstants.INDEX_NOT_FOUND
(-1
). A startIndex larger than the
array length will search from the end of the array.
array
- the array to traverse for looking for the object, may be null
valueToFind
- the value to findstartIndex
- the start index to travers backwards from
PapayaConstants.INDEX_NOT_FOUND
(-1
) if not found or null
array inputpublic static boolean contains(byte[] array, byte valueToFind)
Checks if the value is in the given array.
The method returns false
if a null
array is passed in.
array
- the array to search throughvalueToFind
- the value to find
true
if the array contains the objectpublic static int[] indicesWith(byte[] array, byte valueToFind)
Finds the indices containing the specified value in the array.
This method returns PapayaConstants.INDICES_NOT_FOUND
(int[] = -1
) for a null
input array.
array
- the array to search through for the value to find, may be null
valueToFind
- the value to find
PapayaConstants.INDICES_NOT_FOUND
(int[] = -1
) if not found or null
array inputpublic static int[] indicesWith(byte[] array, byte valueToFind, int startIndex)
Finds the indices containing the specified value in the array.
This method returns PapayaConstants.INDICES_NOT_FOUND
(int[] = -1
) for a null
input array.
array
- the array to search through for the value to find, may be null
valueToFind
- the value to findstartIndex
- the index to start searching at
PapayaConstants.INDICES_NOT_FOUND
(int[] = -1
) if not found or null
array inputpublic static int numRepeats(byte[] array, byte valueToFind)
Finds the number of times a given value/object is present in an array.
array
- the array to search through for the value/objectvalueToFind
- the object to find.
PapayaConstants.INDEX_NOT_FOUND
(-1
) if not found or null
array inputpublic static int indexOf(double[] array, double valueToFind)
Finds the index of the given value in the array.
This method returns PapayaConstants.INDEX_NOT_FOUND
(-1
) for a null
input array.
array
- the array to search through for the object, may be null
valueToFind
- the value to find
PapayaConstants.INDEX_NOT_FOUND
(-1
) if not found or null
array inputpublic static int indexOf(double[] array, double valueToFind, double tolerance)
Finds the index of the given value within a given tolerance in the array. This method will return the index of the first value which falls between the region defined by valueToFind - tolerance and valueToFind + tolerance.
This method returns PapayaConstants.INDEX_NOT_FOUND
(-1
) for a null
input array.
array
- the array to search through for the object, may be null
valueToFind
- the value to findtolerance
- tolerance of the search
PapayaConstants.INDEX_NOT_FOUND
(-1
) if not found or null
array inputpublic static int indexOf(double[] array, double valueToFind, int startIndex)
Finds the index of the given value in the array starting at the given index.
This method returns PapayaConstants.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 PapayaConstants.INDEX_NOT_FOUND
(-1
).
array
- the array to search through for the object, may be null
valueToFind
- the value to findstartIndex
- the index to start searching at
PapayaConstants.INDEX_NOT_FOUND
(-1
) if not found or null
array inputpublic static int indexOf(double[] array, double valueToFind, int startIndex, double tolerance)
Finds the index of the given value in the array starting at the given index. This method will return the index of the first value which falls between the region defined by valueToFind - tolerance and valueToFind + tolerance.
This method returns PapayaConstants.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 PapayaConstants.INDEX_NOT_FOUND
(-1
).
array
- the array to search through for the object, may be null
valueToFind
- the value to findstartIndex
- the index to start searching attolerance
- tolerance of the search
PapayaConstants.INDEX_NOT_FOUND
(-1
) if not found or null
array inputpublic static int lastIndexOf(double[] array, double valueToFind)
Finds the last index of the given value within the array.
This method returns PapayaConstants.INDEX_NOT_FOUND
(-1
) for a null
input array.
array
- the array to travers backwords looking for the object, may be null
valueToFind
- the object to find
PapayaConstants.INDEX_NOT_FOUND
(-1
) if not found or null
array inputpublic static int lastIndexOf(double[] array, double valueToFind, double tolerance)
Finds the last index of the given value within a given tolerance in the array. This method will return the index of the last value which falls between the region defined by valueToFind - tolerance and valueToFind + tolerance.
This method returns PapayaConstants.INDEX_NOT_FOUND
(-1
) for a null
input array.
array
- the array to search through for the object, may be null
valueToFind
- the value to findtolerance
- tolerance of the search
PapayaConstants.INDEX_NOT_FOUND
(-1
) if not found or null
array inputpublic static int lastIndexOf(double[] array, double valueToFind, int startIndex)
Finds the last index of the given value in the array starting at the given index.
This method returns PapayaConstants.INDEX_NOT_FOUND
(-1
) for a null
input array.
A negative startIndex will return PapayaConstants.INDEX_NOT_FOUND
(-1
). A startIndex larger than the
array length will search from the end of the array.
array
- the array to traverse for looking for the object, may be null
valueToFind
- the value to findstartIndex
- the start index to travers backwards from
PapayaConstants.INDEX_NOT_FOUND
(-1
) if not found or null
array inputpublic static int lastIndexOf(double[] array, double valueToFind, int startIndex, double tolerance)
Finds the last index of the given value in the array starting at the given index. This method will return the index of the last value which falls between the region defined by valueToFind - tolerance and valueToFind + tolerance.
This method returns PapayaConstants.INDEX_NOT_FOUND
(-1
) for a null
input array.
A negative startIndex will return PapayaConstants.INDEX_NOT_FOUND
(-1
). A startIndex larger than the
array length will search from the end of the array.
array
- the array to traverse for looking for the object, may be null
valueToFind
- the value to findstartIndex
- the start index to travers backwards fromtolerance
- search for value within plus/minus this amount
PapayaConstants.INDEX_NOT_FOUND
(-1
) if not found or null
array inputpublic static boolean contains(double[] array, double valueToFind)
Checks if the value is in the given array.
The method returns false
if a null
array is passed in.
array
- the array to search throughvalueToFind
- the value to find
true
if the array contains the objectpublic static boolean contains(double[] array, double valueToFind, double tolerance)
Checks if a value falling within the given tolerance is in the given array. If the array contains a value within the inclusive range defined by (value - tolerance) to (value + tolerance).
The method returns false
if a null
array
is passed in.
array
- the array to searchvalueToFind
- the value to findtolerance
- the array contains the tolerance of the search
public static int[] indicesWith(double[] array, double valueToFind)
Finds the indices containing the specified value in the array.
This method returns PapayaConstants.INDICES_NOT_FOUND
(int[] = -1
) for a null
input array.
array
- the array to search through for the value to find, may be null
valueToFind
- the value to find
PapayaConstants.INDICES_NOT_FOUND
(int[] = -1
) if not found or null
array inputpublic static int[] indicesWith(double[] array, double valueToFind, int startIndex)
Finds the indices containing the specified value in the array.
This method returns PapayaConstants.INDICES_NOT_FOUND
(int[] = -1
) for a null
input array.
array
- the array to search through for the value to find, may be null
valueToFind
- the value to findstartIndex
- the index to start searching at
PapayaConstants.INDICES_NOT_FOUND
(int[] = -1
) if not found or null
array inputpublic static int numRepeats(double[] array, double valueToFind)
Finds the number of times a given value/object is present in an array.
array
- the array to search through for the value/objectvalueToFind
- the object to find.
PapayaConstants.INDEX_NOT_FOUND
(-1
) if not found or null
array inputpublic static int indexOf(float[] array, float valueToFind)
Finds the index of the given value in the array.
This method returns PapayaConstants.INDEX_NOT_FOUND
(-1
) for a null
input array.
array
- the array to search through for the object, may be null
valueToFind
- the value to find
PapayaConstants.INDEX_NOT_FOUND
(-1
) if not found or null
array inputpublic static int indexOf(float[] array, float valueToFind, int startIndex)
Finds the index of the given value in the array starting at the given index.
This method returns PapayaConstants.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 PapayaConstants.INDEX_NOT_FOUND
(-1
).
array
- the array to search through for the object, may be null
valueToFind
- the value to findstartIndex
- the index to start searching at
PapayaConstants.INDEX_NOT_FOUND
(-1
) if not found or null
array inputpublic static int lastIndexOf(float[] array, float valueToFind)
Finds the last index of the given value within the array.
This method returns PapayaConstants.INDEX_NOT_FOUND
(-1
) for a null
input array.
array
- the array to travers backwords looking for the object, may be null
valueToFind
- the object to find
PapayaConstants.INDEX_NOT_FOUND
(-1
) if not found or null
array inputpublic static int lastIndexOf(float[] array, float valueToFind, int startIndex)
Finds the last index of the given value in the array starting at the given index.
This method returns PapayaConstants.INDEX_NOT_FOUND
(-1
) for a null
input array.
A negative startIndex will return PapayaConstants.INDEX_NOT_FOUND
(-1
). A startIndex larger than the
array length will search from the end of the array.
array
- the array to traverse for looking for the object, may be null
valueToFind
- the value to findstartIndex
- the start index to travers backwards from
PapayaConstants.INDEX_NOT_FOUND
(-1
) if not found or null
array inputpublic static boolean contains(float[] array, float valueToFind)
Checks if the value is in the given array.
The method returns false
if a null
array is passed in.
array
- the array to search throughvalueToFind
- the value to find
true
if the array contains the objectpublic static int[] indicesWith(float[] array, float valueToFind)
Finds the indices containing the specified value in the array.
This method returns PapayaConstants.INDICES_NOT_FOUND
(int[] = -1
) for a null
input array.
array
- the array to search through for the value to find, may be null
valueToFind
- the value to find
PapayaConstants.INDICES_NOT_FOUND
(int[] = -1
) if not found or null
array inputpublic static int[] indicesWith(float[] array, float valueToFind, int startIndex)
Finds the indices containing the specified value in the array.
This method returns PapayaConstants.INDICES_NOT_FOUND
(int[] = -1
) for a null
input array.
array
- the array to search through for the value to find, may be null
valueToFind
- the value to findstartIndex
- the index to start searching at
PapayaConstants.INDICES_NOT_FOUND
(int[] = -1
) if not found or null
array inputpublic static int[] indicesWithin(float[] array, float minVal, float maxVal)
Finds the indices for the array elements within the min and max value (inclusive).
This method returns PapayaConstants.INDICES_NOT_FOUND
(int[] = -1
) for a null
input array.
public static int numRepeats(float[] array, float valueToFind)
Finds the number of times a given value/object is present in an array.
array
- the array to search through for the value/objectvalueToFind
- the object to find.
PapayaConstants.INDEX_NOT_FOUND
(-1
) if not found or null
array inputpublic static int[] indicesLessThanOrEqualTo(float[] array, float valueOfMax)
public static int[] indicesLessThan(float[] array, float valueOfMax)
public static int[] indicesGreaterThanOrEqualTo(float[] array, float valueOfMin)
public static int[] indicesGreaterThan(float[] array, float valueOfMin)
public static int numLessThanOrEqualTo(float[] array, float valueOfMax)
Finds the number of elements less than or equal to the specified value.
array
- the array to search through for the value/objectvalueOfMax
- the maximum value
public static int numLessThan(float[] array, float valueOfMax)
Finds the number of elements strictly less than the specified value.
array
- the array to search through for the value/objectvalueOfMax
- the maximum value
public static int numGreaterThanOrEqualTo(float[] array, float valueOfMin)
Finds the number of elements greater than or equal to the specified value.
array
- the array to search through for the value/objectvalueOfMax
- the maximum value
public static int numGreaterThan(float[] array, float valueOfMin)
Finds the number of elements strictly greater than the specified value.
array
- the array to search through for the value/objectvalueOfMax
- the maximum value
public static float[] uniqueElems(float[] array)
public static int indexOf(boolean[] array, boolean valueToFind)
Finds the index of the given value in the array.
This method returns PapayaConstants.INDEX_NOT_FOUND
(-1
) for a null
input array.
array
- the array to search through for the object, may be null
valueToFind
- the value to find
PapayaConstants.INDEX_NOT_FOUND
(-1
) if not found or null
array inputpublic static int indexOf(boolean[] array, boolean valueToFind, int startIndex)
Finds the index of the given value in the array starting at the given index.
This method returns PapayaConstants.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 PapayaConstants.INDEX_NOT_FOUND
(-1
).
array
- the array to search through for the object, may be null
valueToFind
- the value to findstartIndex
- the index to start searching at
PapayaConstants.INDEX_NOT_FOUND
(-1
) if not found or null
array inputpublic static int lastIndexOf(boolean[] array, boolean valueToFind)
Finds the last index of the given value within the array.
This method returns PapayaConstants.INDEX_NOT_FOUND
(-1
) if
null
array input.
array
- the array to travers backwords looking for the object, may be null
valueToFind
- the object to find
PapayaConstants.INDEX_NOT_FOUND
(-1
) if not found or null
array inputpublic static int lastIndexOf(boolean[] array, boolean valueToFind, int startIndex)
Finds the last index of the given value in the array starting at the given index.
This method returns PapayaConstants.INDEX_NOT_FOUND
(-1
) for a null
input array.
A negative startIndex will return PapayaConstants.INDEX_NOT_FOUND
(-1
). A startIndex larger than
the array length will search from the end of the array.
array
- the array to traverse for looking for the object, may be null
valueToFind
- the value to findstartIndex
- the start index to travers backwards from
PapayaConstants.INDEX_NOT_FOUND
(-1
) if not found or null
array inputpublic static int[] indicesWith(boolean[] array, boolean valueToFind)
Finds the indices containing the specified value in the array.
This method returns PapayaConstants.INDICES_NOT_FOUND
(int[] = -1
) for a null
input array.
array
- the array to search through for the value to find, may be null
valueToFind
- the value to find
PapayaConstants.INDICES_NOT_FOUND
(int[] = -1
) if not found or null
array inputpublic static int[] indicesWith(boolean[] array, boolean valueToFind, int startIndex)
Finds the indices containing the specified value in the array.
This method returns PapayaConstants.INDICES_NOT_FOUND
(int[] = -1
) for a null
input array.
array
- the array to search through for the value to find, may be null
valueToFind
- the value to findstartIndex
- the index to start searching at
PapayaConstants.INDICES_NOT_FOUND
(int[] = -1
) if not found or null
array inputpublic static int numRepeats(boolean[] array, boolean valueToFind)
Finds the number of times a given value/object is present in an array.
array
- the array to search through for the value/objectvalueToFind
- the object to find.
PapayaConstants.INDEX_NOT_FOUND
(-1
) if not found or null
array input
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |