public class CheapArray extends Object
Modifier and Type | Method and Description |
---|---|
static void |
add(int index,
Object item,
Object array)
Adds an item to a cheapArray at a specific position.
|
static void |
add(Object item,
Object array)
Adds an item to a cheapArray.
|
static Object |
add(Object item,
Object array,
Object[] emptyArray)
Adds an item to a cheapArray.
|
static Object |
create(int initialCapacity)
Create a new cheapArray.
|
static Object |
get(int i,
Object array)
Get a particular item from a cheapArray.
|
static Object |
optimize(Object array,
Object[] emptyArray)
Optimize the cheapArray so it uses the minimum possible memory.
|
static void |
remove(Object item,
Object array)
Remove an item from a cheapArray.
|
static Object |
remove(Object item,
Object array,
Object[] emptyArray)
Remove an item from a cheapArray.
|
static void |
replace(int index,
Object item,
Object array)
Replaces the item at the given index in the passed in array
|
static int |
size(Object array)
Get the number of items of a cheapArray.
|
static void |
sort(Object array,
Comparator comparator)
Sorts the given array based on a comparator
|
static Object[] |
toArray(Object array,
Object[] emptyArray)
Fetch the contents of a cheapArray.
|
public static Object create(int initialCapacity)
initialCapacity
- the initial capacity of the cheapArray.public static Object[] toArray(Object array, Object[] emptyArray)
array
- a cheapArrayemptyArray
- a zero-length array. The array returned by this function
will be the same runtime type as this parameter.public static int size(Object array)
array
- a cheapArraypublic static Object get(int i, Object array)
i
- the item's indexarray
- a cheapArraypublic static void add(Object item, Object array)
item
- the item to addarray
- a cheapArraypublic static void sort(Object array, Comparator comparator)
array
- the array to sortcomparator
- a comparatorpublic static Object add(Object item, Object array, Object[] emptyArray)
item
- the item to addarray
- a cheapArraypublic static void add(int index, Object item, Object array)
index
- the position at which to add the itemitem
- the item to addarray
- a cheapArraypublic static void replace(int index, Object item, Object array)
index
- the index to replace atitem
- the item to use as a replacementarray
- the array to operate onpublic static void remove(Object item, Object array)
item
- the item to removearray
- a cheapArraypublic static Object remove(Object item, Object array, Object[] emptyArray)
item
- the item to removearray
- a cheapArraypublic static Object optimize(Object array, Object[] emptyArray)
array
- a cheapArrayemptyArray
- a zero-length array. The array returned by this function
will be the same runtime type as this parameter.Copyright © 2016 The Apache Software Foundation. All rights reserved.