# linked list
[utilities]

## Classes
struct | entry_s
## Typedefs
typedef struct entry_s | entry_t
## Functions
AXIS2_EXTERN axutil_linked_list_t * | axutil_linked_list_create (const axutil_env_t *env)
AXIS2_EXTERN void | axutil_linked_list_free (axutil_linked_list_t *linked_list, const axutil_env_t *env)
AXIS2_EXTERN entry_t * | axutil_linked_list_get_entry (axutil_linked_list_t *linked_list, const axutil_env_t *env, int n)
AXIS2_EXTERN axis2_status_t | axutil_linked_list_remove_entry (axutil_linked_list_t *linked_list, const axutil_env_t *env, entry_t *e)
AXIS2_EXTERN axis2_bool_t | axutil_linked_list_check_bounds_inclusive (axutil_linked_list_t *linked_list, const axutil_env_t *env, int index)
AXIS2_EXTERN axis2_bool_t | axutil_linked_list_check_bounds_exclusive (axutil_linked_list_t *linked_list, const axutil_env_t *env, int index)
AXIS2_EXTERN void * | axutil_linked_list_get_first (axutil_linked_list_t *linked_list, const axutil_env_t *env)
AXIS2_EXTERN void * | axutil_linked_list_get_last (axutil_linked_list_t *linked_list, const axutil_env_t *env)
AXIS2_EXTERN void * | axutil_linked_list_remove_first (axutil_linked_list_t *linked_list, const axutil_env_t *env)
AXIS2_EXTERN void * | axutil_linked_list_remove_last (axutil_linked_list_t *linked_list, const axutil_env_t *env)
AXIS2_EXTERN axis2_status_t | axutil_linked_list_add_first (axutil_linked_list_t *linked_list, const axutil_env_t *env, void *o)
AXIS2_EXTERN axis2_status_t | axutil_linked_list_add_last (axutil_linked_list_t *linked_list, const axutil_env_t *env, void *o)
AXIS2_EXTERN axis2_bool_t | axutil_linked_list_contains (axutil_linked_list_t *linked_list, const axutil_env_t *env, void *o)
AXIS2_EXTERN int | axutil_linked_list_size (axutil_linked_list_t *linked_list, const axutil_env_t *env)
AXIS2_EXTERN axis2_bool_t | axutil_linked_list_add (axutil_linked_list_t *linked_list, const axutil_env_t *env, void *o)
AXIS2_EXTERN axis2_bool_t | axutil_linked_list_remove (axutil_linked_list_t *linked_list, const axutil_env_t *env, void *o)
AXIS2_EXTERN axis2_status_t | axutil_linked_list_clear (axutil_linked_list_t *linked_list, const axutil_env_t *env)
AXIS2_EXTERN void * | axutil_linked_list_get (axutil_linked_list_t *linked_list, const axutil_env_t *env, int index)
AXIS2_EXTERN void * | axutil_linked_list_set (axutil_linked_list_t *linked_list, const axutil_env_t *env, int index, void *o)
AXIS2_EXTERN axis2_status_t | axutil_linked_list_add_at_index (axutil_linked_list_t *linked_list, const axutil_env_t *env, int index, void *o)
AXIS2_EXTERN void * | axutil_linked_list_remove_at_index (axutil_linked_list_t *linked_list, const axutil_env_t *env, int index)
AXIS2_EXTERN int | axutil_linked_list_index_of (axutil_linked_list_t *linked_list, const axutil_env_t *env, void *o)
AXIS2_EXTERN int | axutil_linked_list_last_index_of (axutil_linked_list_t *linked_list, const axutil_env_t *env, void *o)
AXIS2_EXTERN void ** | axutil_linked_list_to_array (axutil_linked_list_t *linked_list, const axutil_env_t *env)
## Variables
struct entry_s * | entry_s::next
struct entry_s * | entry_s::previous

## Typedef Documentation

typedef struct entry_s entry_t

Struct to represent an entry in the list. Holds a single element.

## Function Documentation

AXIS2_EXTERN axis2_bool_t axutil_linked_list_add | ( | axutil_linked_list_t * | linked_list,
|  | const axutil_env_t * | env,
|  | void * | o |
| ) |  |  |

Adds an element to the end of the list.

Parameters:

  | e | the entry to add

Returns:
  true, as it always succeeds

AXIS2_EXTERN axis2_status_t axutil_linked_list_add_at_index | ( | axutil_linked_list_t * | linked_list,
|  | const axutil_env_t * | env,
|  | int | index,
|  | void * | o |
| ) |  |  |

Inserts an element in the given position in the list.

Parameters:

  | index | where to insert the element
  | o | the element to insert

AXIS2_EXTERN axis2_status_t axutil_linked_list_add_first | ( | axutil_linked_list_t * | linked_list,
|  | const axutil_env_t * | env,
|  | void * | o |
| ) |  |  |

Insert an element at the first of the list.

Parameters:

  | o | the element to insert

AXIS2_EXTERN axis2_status_t axutil_linked_list_add_last | ( | axutil_linked_list_t * | linked_list,
|  | const axutil_env_t * | env,
|  | void * | o |
| ) |  |  |

Insert an element at the last of the list.

Parameters:

  | o | the element to insert

AXIS2_EXTERN axis2_bool_t axutil_linked_list_check_bounds_exclusive | ( | axutil_linked_list_t * | linked_list,
|  | const axutil_env_t * | env,
|  | int | index |
| ) |  |  |

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

Parameters:

  | index | the index to check

AXIS2_EXTERN axis2_bool_t axutil_linked_list_check_bounds_inclusive | ( | axutil_linked_list_t * | linked_list,
|  | const axutil_env_t * | env,
|  | int | index |
| ) |  |  |

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

Parameters:

  | index | the index to check

AXIS2_EXTERN axis2_status_t axutil_linked_list_clear | ( | axutil_linked_list_t * | linked_list,
|  | const axutil_env_t * | env |
| ) |  |  |

Remove all elements from this list.

AXIS2_EXTERN axis2_bool_t axutil_linked_list_contains | ( | axutil_linked_list_t * | linked_list,
|  | const axutil_env_t * | env,
|  | void * | o |
| ) |  |  |

Returns true if the list contains the given object. Comparison is done by `o == null ? e = null : o.equals(e)`.

Parameters:

  | o | the element to look for

Returns:
  true if it is found

AXIS2_EXTERN axutil_linked_list_t* axutil_linked_list_create | ( | const axutil_env_t * | env | ) |

Create an empty linked list.

AXIS2_EXTERN void* axutil_linked_list_get | ( | axutil_linked_list_t * | linked_list,
|  | const axutil_env_t * | env,
|  | int | index |
| ) |  |  |

Return the element at index.

Parameters:

  | index | the place to look

Returns:
  the element at index

AXIS2_EXTERN entry_t* axutil_linked_list_get_entry | ( | axutil_linked_list_t * | linked_list,
|  | const axutil_env_t * | env,
|  | int | n |
| ) |  |  |

Obtain the Entry at a given position in a list. This method of course takes linear time, but it is intelligent enough to take the shorter of the paths to get to the Entry required. This implies that the first or last entry in the list is obtained in constant time, which is a very desirable property. For speed and flexibility, range checking is not done in this method: Incorrect values will be returned if (n < 0) or (n >= size).

Parameters:

  | n | the number of the entry to get

Returns:
  the entry at position n

AXIS2_EXTERN void* axutil_linked_list_get_first | ( | axutil_linked_list_t * | linked_list,
|  | const axutil_env_t * | env |
| ) |  |  |

Returns the first element in the list.

Returns:
  the first list element

AXIS2_EXTERN void* axutil_linked_list_get_last | ( | axutil_linked_list_t * | linked_list,
|  | const axutil_env_t * | env |
| ) |  |  |

Returns the last element in the list.

Returns:
  the last list element

AXIS2_EXTERN int axutil_linked_list_index_of | ( | axutil_linked_list_t * | linked_list,
|  | const axutil_env_t * | env,
|  | void * | o |
| ) |  |  |

Returns the first index where the element is located in the list, or -1.

Parameters:

  | o | the element to look for

Returns:
  its position, or -1 if not found

AXIS2_EXTERN int axutil_linked_list_last_index_of | ( | axutil_linked_list_t * | linked_list,
|  | const axutil_env_t * | env,
|  | void * | o |
| ) |  |  |

Returns the last index where the element is located in the list, or -1.

Parameters:

  | o | the element to look for

Returns:
  its position, or -1 if not found

AXIS2_EXTERN axis2_bool_t axutil_linked_list_remove | ( | axutil_linked_list_t * | linked_list,
|  | const axutil_env_t * | env,
|  | void * | o |
| ) |  |  |

Removes the entry at the lowest index in the list that matches the given object, comparing by `o == null ? e = null : o.equals(e)`.

Parameters:

  | o | the object to remove

Returns:
  true if an instance of the object was removed

AXIS2_EXTERN void* axutil_linked_list_remove_at_index | ( | axutil_linked_list_t * | linked_list,
|  | const axutil_env_t * | env,
|  | int | index |
| ) |  |  |

Removes the element at the given position from the list.

Parameters:

  | index | the location of the element to remove

Returns:
  the removed element

AXIS2_EXTERN axis2_status_t axutil_linked_list_remove_entry | ( | axutil_linked_list_t * | linked_list,
|  | const axutil_env_t * | env,
|  | entry_t * | e |
| ) |  |  |

Remove an entry from the list. This will adjust size and deal with `first' and `last' appropriatly.

Parameters:

  | e | the entry to remove

AXIS2_EXTERN void* axutil_linked_list_remove_first | ( | axutil_linked_list_t * | linked_list,
|  | const axutil_env_t * | env |
| ) |  |  |

Remove and return the first element in the list.

Returns:
  the former first element in the list

AXIS2_EXTERN void* axutil_linked_list_remove_last | ( | axutil_linked_list_t * | linked_list,
|  | const axutil_env_t * | env |
| ) |  |  |

Remove and return the last element in the list.

Returns:
  the former last element in the list

AXIS2_EXTERN void* axutil_linked_list_set | ( | axutil_linked_list_t * | linked_list,
|  | const axutil_env_t * | env,
|  | int | index,
|  | void * | o |
| ) |  |  |

Replace the element at the given location in the list.

Parameters:

  | index | which index to change
  | o | the new element

Returns:
  the prior element

AXIS2_EXTERN int axutil_linked_list_size | ( | axutil_linked_list_t * | linked_list,
|  | const axutil_env_t * | env |
| ) |  |  |

Returns the size of the list.

Returns:
  the list size

AXIS2_EXTERN void** axutil_linked_list_to_array | ( | axutil_linked_list_t * | linked_list,
|  | const axutil_env_t * | env |
| ) |  |  |

Returns an array which contains the elements of the list in order.

Returns:
  an array containing the list elements

## Variable Documentation

struct entry_s* entry_s::next`[read, inherited]`

The next list entry, null if this is last.

struct entry_s* entry_s::previous`[read, inherited]`

The previous list entry, null if this is first.