find a object in array

@param array
@param object object to find
@return position in array or 0
19599
public static int find(Array array, Object object) {
	int len = array.size();
	for (int i = 1; i <= len; i++) {
	    Object tmp = array.get(i, null);
	    try {
		if (tmp != null && Operator.compare(object, tmp) == 0) return i;
	    }
	    catch (PageException e) {}
	}
	return 0;
    }
1189395
protected <Type> void addIfNotNull(final Array<Type> array, final Type object) {
        if (object != null) {
            array.add(object);
        }
    }
322569
public static boolean get(boolean[] array, int position) {
        return !(position < 0 || position >= Utils.sizeOf(array)) && array[position];
    }
805092
public function find($array, $params)
    {
        if (count($array)) {
            foreach ($array as $item) {
                $found = true;
                foreach ($params as $key => $value) {
                    if ($item->$key != $value) {
                        $found = false;
                    }
                }
                if ($found) {
                    return $item;
                }
            }
        }

        return null;
    }
1181458
function arrayObjectIndexOf(arr, obj)
        {
            for (var i = 0; i < arr.length; i++)
            {
                if (angular.equals(arr[i], obj))
                {
                    return i;
                }
            }

            return -1;
        }
73018
int remove(T object) {
        int positionOfRemove = mObjects.indexOf(object);
        if (positionOfRemove >= 0) {
            T objectRemoved = removeAt(positionOfRemove);
            if (objectRemoved != null) {
                return positionOfRemove;
            }
        }
        return -1;
    }
582730
function findPosition(array, id) {
    var position = -1;

    for(var i = 0, len = array.length; i < len; i += 1) {
        if(array[i].$id === id) position = i;
    }

    return position;
}
315394
public static <T> T find(T[] array, Predicate<T> predicate){
        if(array == null){
            return null;
        }
        for(T t: array){
            if(predicate.apply(t)){
                return t;
            }
        }
        return null;
    }
526748
public static int find(Object[] arr, int start, int end, Object valueToFind) {
    assert arr != null;
    assert end >= 0;
    assert end <= arr.length;


    for (int i = start; i < end; i++) {
      if (Objects.equals(arr[i], valueToFind)) {
        return i;
      }
    }

    return NOT_FOUND;
  }
214573
function array2object(arr, key){

//    if(typeof arr != "object" || !arr.hasOwnProperty("length")){}

    if(!util.isArray(arr) || !key || typeof key != "string"){
        return false;
    }

    var obj = {};
    for(var index in arr){
        if(arr.hasOwnProperty(index)){
            (function(index){
                var k  = arr[index][key];
                obj[k] = arr[index];
            })(index);
        }
    }

    return obj;
}
1122107
private int search(Object[] keys, Object toFind)
    {
        for (int i = 0; i < keys.length; ++i)
        {
            if (toFind == null)
            {
                if (keys[i] == null)
                    return i;
            }
            else if (toFind.equals(keys[i]))
                return i;
        }
        return -1; // niets gevonden
    }
5627
protected final Object arrayLookup(Object array, int index) {
        LOGGER.trace("get value from array index " + index);
        return Array.get(array, index);
    }
695971
@SuppressWarnings("unchecked")
	public static <T> T get(Object array, int index) {
		if(null == array) {
			return null;
		}
		
		if (index < 0) {
			index += Array.getLength(array);
		}
		try {
			return (T) Array.get(array, index);
		} catch (ArrayIndexOutOfBoundsException e) {
			return null;
		}
	}
903519
static <V> int find(Comparator<V> comparator, Object key, Object[] a, final int fromIndex, final int toIndex)
    {
        int low = fromIndex;
        int high = toIndex - 1;

        while (low <= high)
        {
            int mid = (low + high) / 2;
            int cmp = comparator.compare((V) key, (V) a[mid]);

            if (cmp > 0)
                low = mid + 1;
            else if (cmp < 0)
                high = mid - 1;
            else
                return mid; // key found
        }
        return -(low + 1);  // key not found.
    }
1196418
function findValues(toSearch, ...searchFor) {
  const searchesLen = searchFor.length;
  let results = {};
  let searches = {};

  for (let i = 0; i < searchesLen; i++) {
    searches[searchFor[i]] = true;
  }

  /* Object, Object -> Void */
  function traverseObject(toSearchObj, searchForObj) {
    const allKeys = Object.keys(toSearchObj);
    const len = allKeys.length;

    for (let i = 0; i < len; i++) {
      const key = allKeys[i];
      const val = toSearchObj[key];

      if (searchForObj[key] && !results[key]) {
        results[key] = val;
      } else if (isObject(val)) {
        traverseObject(val, searchForObj);
      } else if (isArray(val)) {
        traverseArray(val, searchForObj);
      }
    }
  }

  /* Array, Object -> Void */
  function traverseArray(arr, searchForObj) {
    const len = arr.length;

    for (let i = 0; i < len; i++) {
      const item = arr[i];

      if (isArray(item)) {
        traverseArray(item, searchForObj);
      } else if (isObject(item)) {
        traverseObject(item, searchForObj);
      }
    }
  }

  traverseObject(toSearch, searches);

  return results;
}
1081789
public static Iterator<Object> getValues(Object[] array)
    {
        if (array == null)
        {
            return null;
        }
        ArrayList<Object> valueList = new ArrayList<Object>();
        int i = array.length - 1;
        while (i >= 0)
        {
            valueList.add(array[i]);
            i = i - 2;
        }
        return valueList.iterator();
    }
954583
public static Object[] arrayPut(final Object[] array, final int pos, final Object value){
        final Object[] ret = Arrays.copyOf(array, array.length+1);
        if(pos<array.length){
            System.arraycopy(array, pos, ret, pos+1, array.length-pos);
        }
        ret[pos] = value;
        return ret;
    }