# array list
[utilities]

## Files
file | axutil_array_list.h
| Axis2 array_list interface.

## Defines
#define | AXIS2_ARRAY_LIST_DEFAULT_CAPACITY 16
## Typedefs
typedef struct axutil_array_list | axutil_array_list_t
## Functions
AXIS2_EXTERN axutil_array_list_t * | axutil_array_list_create (const axutil_env_t *env, int capacity)
AXIS2_EXTERN void | axutil_array_list_free_void_arg (void *array_list, const axutil_env_t *env)
AXIS2_EXTERN axis2_status_t | axutil_array_list_ensure_capacity (struct axutil_array_list *array_list, const axutil_env_t *env, int min_capacity)
AXIS2_EXTERN int | axutil_array_list_size (struct axutil_array_list *array_list, const axutil_env_t *env)
AXIS2_EXTERN axis2_bool_t | axutil_array_list_is_empty (struct axutil_array_list *array_list, const axutil_env_t *env)
AXIS2_EXTERN axis2_bool_t | axutil_array_list_contains (struct axutil_array_list *array_list, const axutil_env_t *env, void *e)
AXIS2_EXTERN int | axutil_array_list_index_of (struct axutil_array_list *array_list, const axutil_env_t *env, void *e)
AXIS2_EXTERN void * | axutil_array_list_get (struct axutil_array_list *array_list, const axutil_env_t *env, int index)
AXIS2_EXTERN void * | axutil_array_list_set (struct axutil_array_list *array_list, const axutil_env_t *env, int index, void *e)
AXIS2_EXTERN axis2_status_t | axutil_array_list_add (struct axutil_array_list *array_list, const axutil_env_t *env, const void *e)
AXIS2_EXTERN axis2_status_t | axutil_array_list_add_at (struct axutil_array_list *array_list, const axutil_env_t *env, const int index, const void *e)
AXIS2_EXTERN void * | axutil_array_list_remove (struct axutil_array_list *array_list, const axutil_env_t *env, int index)
AXIS2_EXTERN axis2_bool_t | axutil_array_list_check_bound_inclusive (struct axutil_array_list *array_list, const axutil_env_t *env, int index)
AXIS2_EXTERN axis2_bool_t | axutil_array_list_check_bound_exclusive (struct axutil_array_list *array_list, const axutil_env_t *env, int index)
AXIS2_EXTERN void | axutil_array_list_free (struct axutil_array_list *array_list, const axutil_env_t *env)

## Detailed Description

Description.

## Typedef Documentation

typedef struct axutil_array_list axutil_array_list_t

Array List struct

## Function Documentation

AXIS2_EXTERN axis2_status_t axutil_array_list_add | ( | struct axutil_array_list * | array_list,
|  | const axutil_env_t * | env,
|  | const void * | e |
| ) |  |  |

Appends the supplied element to the end of this list. The element, e, can be a pointer of any type or NULL.

Parameters:

  | array_list | pointer to array list
  | env | pointer to environment struct
  | e | the element to be appended to this list

Returns:
  AXIS2_SUCCESS on success, else AXIS2_FAILURE

AXIS2_EXTERN axis2_status_t axutil_array_list_add_at | ( | struct axutil_array_list * | array_list,
|  | const axutil_env_t * | env,
|  | const int | index,
|  | const void * | e |
| ) |  |  |

Adds the supplied element at the specified index, shifting all elements currently at that index or higher one to the right. The element, e, can be a pointer of any type or NULL.

Parameters:

  | array_list | pointer to array list
  | env | pointer to environment struct
  | index | the index at which the element is being added
  | e | the item being added

Returns:
  AXIS2_SUCCESS on success, else AXIS2_FAILURE

AXIS2_EXTERN axis2_bool_t axutil_array_list_check_bound_exclusive | ( | struct axutil_array_list * | array_list,
|  | const axutil_env_t * | env,
|  | int | index |
| ) |  |  |

Checks that the index is in the range of existing elements (exclusive).

Parameters:

  | array_list | pointer to array list
  | env | pointer to environment struct
  | index | the index to check

Returns:
  AXIS2_FALSE if index >= size or index < 0, else AXIS2_TRUE

AXIS2_EXTERN axis2_bool_t axutil_array_list_check_bound_inclusive | ( | struct axutil_array_list * | array_list,
|  | const axutil_env_t * | env,
|  | int | index |
| ) |  |  |

Checks that the index is in the range of possible elements (inclusive).

Parameters:

  | array_list | pointer to array list
  | env | pointer to environment struct
  | index | the index to check

Returns:
  AXIS2_FALSE if index > size or index < 0, else AXIS2_TRUE

AXIS2_EXTERN axis2_bool_t axutil_array_list_contains | ( | struct axutil_array_list * | array_list,
|  | const axutil_env_t * | env,
|  | void * | e |
| ) |  |  |

Returns true iff element is in this array_list.

Parameters:

  | array_list | pointer to array list
  | env | pointer to environment struct
  | e | the element whose inclusion in the List is being tested

Returns:
  true if the list contains e

AXIS2_EXTERN axutil_array_list_t* axutil_array_list_create | ( | const axutil_env_t * | env,
|  | int | capacity |
| ) |  |  |

Constructs a new array list with the supplied initial capacity. If capacity is invalid (<= 0) then default capacity is used

Parameters:

  | env | pointer to environment struct
  | capacity | initial capacity of this array_list

AXIS2_EXTERN axis2_status_t axutil_array_list_ensure_capacity | ( | struct axutil_array_list * | array_list,
|  | const axutil_env_t * | env,
|  | int | min_capacity |
| ) |  |  |

Guarantees that this list will have at least enough capacity to hold min_capacity elements. This implementation will grow the list to max(current * 2, min_capacity)

Parameters:

  | array_list | pointer to array_list
  | env | pointer to environment struct
  | min_capacity | the minimum guaranteed capacity

Returns:
  AXIS2_SUCCESS on success, else AXIS2_FAILURE

AXIS2_EXTERN void axutil_array_list_free | ( | struct axutil_array_list * | array_list,
|  | const axutil_env_t * | env |
| ) |  |  |

Parameters:

  | array_list | pointer to array list
  | env | pointer to environment struct

Returns:
  AXIS2_SUCCESS on success, else AXIS2_FAILURE

AXIS2_EXTERN void axutil_array_list_free_void_arg | ( | void * | array_list,
|  | const axutil_env_t * | env |
| ) |  |  |

Free array passed as void pointer.

Parameters:

  | array_list | pointer to array list
  | env | pointer to environment struct

AXIS2_EXTERN void* axutil_array_list_get | ( | struct axutil_array_list * | array_list,
|  | const axutil_env_t * | env,
|  | int | index |
| ) |  |  |

Retrieves the element at the user-supplied index.

Parameters:

  | array_list | pointer to array list
  | env | pointer to environment struct
  | index | the index of the element we are fetching

Returns:
  element at the given index

AXIS2_EXTERN int axutil_array_list_index_of | ( | struct axutil_array_list * | array_list,
|  | const axutil_env_t * | env,
|  | void * | e |
| ) |  |  |

Returns the lowest index at which element appears in this List, or -1 if it does not appear. This looks for the pointer value equality only, does not look into pointer content

Parameters:

  | array_list | pointer to array list
  | env | pointer to environment struct
  | e | the element whose inclusion in the List is being tested

Returns:
  the index where e was found

AXIS2_EXTERN axis2_bool_t axutil_array_list_is_empty | ( | struct axutil_array_list * | array_list,
|  | const axutil_env_t * | env |
| ) |  |  |

Checks if the list is empty.

Parameters:

  | array_list | pointer to array list
  | env | pointer to environment struct

Returns:
  true if there are no elements, else false

AXIS2_EXTERN void* axutil_array_list_remove | ( | struct axutil_array_list * | array_list,
|  | const axutil_env_t * | env,
|  | int | index |
| ) |  |  |

Removes the element at the user-supplied index.

Parameters:

  | array_list | pointer to array list
  | env | pointer to environment struct
  | index | the index of the element to be removed

Returns:
  the removed void* pointer

AXIS2_EXTERN void* axutil_array_list_set | ( | struct axutil_array_list * | array_list,
|  | const axutil_env_t * | env,
|  | int | index,
|  | void * | e |
| ) |  |  |

Sets the element at the specified index. The new element, e, can be an object of any type or null.

Parameters:

  | array_list | pointer to array list
  | env | pointer to environment struct
  | index | the index at which the element is being set
  | e | the element to be set

Returns:
  the element previously at the specified index

AXIS2_EXTERN int axutil_array_list_size | ( | struct axutil_array_list * | array_list,
|  | const axutil_env_t * | env |
| ) |  |  |

Returns the number of elements in this list.

Parameters:

  | array_list | pointer to array list
  | env | pointer to environment struct

Returns:
  the list size