Package gnu.trove.impl.unmodifiable
Class TUnmodifiableCharList
- java.lang.Object
-
- gnu.trove.impl.unmodifiable.TUnmodifiableCharCollection
-
- gnu.trove.impl.unmodifiable.TUnmodifiableCharList
-
- All Implemented Interfaces:
TCharList,TCharCollection,java.io.Serializable
- Direct Known Subclasses:
TUnmodifiableRandomAccessCharList
public class TUnmodifiableCharList extends TUnmodifiableCharCollection implements TCharList
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description TUnmodifiableCharList(TCharList list)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(char[] vals)Adds the values in the array vals to the end of the list, in order.voidadd(char[] vals, int offset, int length)Adds a subset of the values in the array vals to the end of the list, in order.intbinarySearch(char value)Performs a binary search for value in the entire list.intbinarySearch(char value, int fromIndex, int toIndex)Performs a binary search for value in the specified range.booleanequals(java.lang.Object o)Compares the specified object with this collection for equality.voidfill(char val)Fills every slot in the list with the specified value.voidfill(int fromIndex, int toIndex, char val)Fills a range in the list with the specified value.booleanforEachDescending(TCharProcedure procedure)Applies the procedure to each value in the list in descending (back to front) order.charget(int index)Returns the value at the specified offset.TCharListgrep(TCharProcedure condition)Searches the list for values satisfying condition in the manner of the *nix grep utility.inthashCode()Returns the hash code value for this collection.intindexOf(char o)Searches the list front to back for the index of value.intindexOf(int offset, char value)Searches the list front to back for the index of value, starting at offset.voidinsert(int offset, char value)Inserts value into the list at offset.voidinsert(int offset, char[] values)Inserts the array of values into the list at offset.voidinsert(int offset, char[] values, int valOffset, int len)Inserts a slice of the array of values into the list at offset.TCharListinverseGrep(TCharProcedure condition)Searches the list for values which do not satisfy condition.intlastIndexOf(char o)Searches the list back to front for the last index of value.intlastIndexOf(int offset, char value)Searches the list back to front for the last index of value, starting at offset.charmax()Finds the maximum value in the list.charmin()Finds the minimum value in the list.voidremove(int offset, int length)Removes length values from the list, starting at offsetcharremoveAt(int offset)Removes value at a given offset from the list.charreplace(int offset, char val)Sets the value at the specified offset and returns the previously stored value.voidreverse()Reverse the order of the elements in the list.voidreverse(int from, int to)Reverse the order of the elements in the range of the list.charset(int offset, char val)Sets the value at the specified offset.voidset(int offset, char[] values)Replace the values in the list starting at offset with the contents of the values array.voidset(int offset, char[] values, int valOffset, int length)Replace the values in the list starting at offset with length values from the values array, starting at valOffset.voidshuffle(java.util.Random rand)Shuffle the elements of the list using the specified random number generator.voidsort()Sort the values in the list (ascending) using the Sun quicksort implementation.voidsort(int fromIndex, int toIndex)Sort a slice of the list (ascending) using the Sun quicksort implementation.TCharListsubList(int fromIndex, int toIndex)Returns a sublist of this list.charsum()Calculates the sum of all the values in the list.char[]toArray(char[] dest, int offset, int len)Copies a slice of the list into a native array.char[]toArray(char[] dest, int source_pos, int dest_pos, int len)Copies a slice of the list into a native array.char[]toArray(int offset, int len)Copies a slice of the list into a native array.voidtransformValues(TCharFunction function)Transform each value in the list using the specified function.-
Methods inherited from class gnu.trove.impl.unmodifiable.TUnmodifiableCharCollection
add, addAll, addAll, addAll, clear, contains, containsAll, containsAll, containsAll, forEach, getNoEntryValue, isEmpty, iterator, remove, removeAll, removeAll, removeAll, retainAll, retainAll, retainAll, size, toArray, toArray, toString
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface gnu.trove.TCharCollection
addAll, addAll, addAll, containsAll, containsAll, containsAll, iterator, removeAll, removeAll, removeAll, retainAll, retainAll, retainAll
-
-
-
-
Constructor Detail
-
TUnmodifiableCharList
public TUnmodifiableCharList(TCharList list)
-
-
Method Detail
-
equals
public boolean equals(java.lang.Object o)
Description copied from interface:TCharCollectionCompares the specified object with this collection for equality. Returns true if the specified object is also a collection, the two collection have the same size, and every member of the specified collection is contained in this collection (or equivalently, every member of this collection is contained in the specified collection). This definition ensures that the equals method works properly across different implementations of the collection interface.- Specified by:
equalsin interfaceTCharCollection- Overrides:
equalsin classjava.lang.Object- Parameters:
o- object to be compared for equality with this collection- Returns:
- true if the specified object is equal to this collection
-
hashCode
public int hashCode()
Description copied from interface:TCharCollectionReturns the hash code value for this collection. The hash code of a collection is defined to be the sum of the hash codes of the elements in the collection. This ensures that s1.equals(s2) implies that s1.hashCode()==s2.hashCode() for any two collection s1 and s2, as required by the general contract ofObject.hashCode().- Specified by:
hashCodein interfaceTCharCollection- Overrides:
hashCodein classjava.lang.Object- Returns:
- the hash code value for this collection
- See Also:
Object.equals(Object),Collection.equals(Object)
-
get
public char get(int index)
Description copied from interface:TCharListReturns the value at the specified offset.
-
indexOf
public int indexOf(char o)
Description copied from interface:TCharListSearches the list front to back for the index of value.- Specified by:
indexOfin interfaceTCharList- Parameters:
o- ancharvalue- Returns:
- the first offset of the value, or -1 if it is not in the list.
- See Also:
for faster searches on sorted lists
-
lastIndexOf
public int lastIndexOf(char o)
Description copied from interface:TCharListSearches the list back to front for the last index of value.- Specified by:
lastIndexOfin interfaceTCharList- Parameters:
o- ancharvalue- Returns:
- the last offset of the value, or -1 if it is not in the list.
- See Also:
for faster searches on sorted lists
-
toArray
public char[] toArray(int offset, int len)Description copied from interface:TCharListCopies a slice of the list into a native array.
-
toArray
public char[] toArray(char[] dest, int offset, int len)Description copied from interface:TCharListCopies a slice of the list into a native array.
-
toArray
public char[] toArray(char[] dest, int source_pos, int dest_pos, int len)Description copied from interface:TCharListCopies a slice of the list into a native array.
-
forEachDescending
public boolean forEachDescending(TCharProcedure procedure)
Description copied from interface:TCharListApplies the procedure to each value in the list in descending (back to front) order.- Specified by:
forEachDescendingin interfaceTCharList- Parameters:
procedure- aTCharProcedurevalue- Returns:
- true if the procedure did not terminate prematurely.
-
binarySearch
public int binarySearch(char value)
Description copied from interface:TCharListPerforms a binary search for value in the entire list. Note that you must @{link #sort sort} the list before doing a search.- Specified by:
binarySearchin interfaceTCharList- Parameters:
value- the value to search for- Returns:
- the absolute offset in the list of the value, or its negative insertion point into the sorted list.
-
binarySearch
public int binarySearch(char value, int fromIndex, int toIndex)Description copied from interface:TCharListPerforms a binary search for value in the specified range. Note that you must @{link #sort sort} the list or the range before doing a search.- Specified by:
binarySearchin interfaceTCharList- Parameters:
value- the value to search forfromIndex- the lower boundary of the range (inclusive)toIndex- the upper boundary of the range (exclusive)- Returns:
- the absolute offset in the list of the value, or its negative insertion point into the sorted list.
-
indexOf
public int indexOf(int offset, char value)Description copied from interface:TCharListSearches the list front to back for the index of value, starting at offset.- Specified by:
indexOfin interfaceTCharList- Parameters:
offset- the offset at which to start the linear search (inclusive)value- ancharvalue- Returns:
- the first offset of the value, or -1 if it is not in the list.
- See Also:
for faster searches on sorted lists
-
lastIndexOf
public int lastIndexOf(int offset, char value)Description copied from interface:TCharListSearches the list back to front for the last index of value, starting at offset.- Specified by:
lastIndexOfin interfaceTCharList- Parameters:
offset- the offset at which to start the linear search (exclusive)value- ancharvalue- Returns:
- the last offset of the value, or -1 if it is not in the list.
- See Also:
for faster searches on sorted lists
-
grep
public TCharList grep(TCharProcedure condition)
Description copied from interface:TCharListSearches the list for values satisfying condition in the manner of the *nix grep utility.
-
inverseGrep
public TCharList inverseGrep(TCharProcedure condition)
Description copied from interface:TCharListSearches the list for values which do not satisfy condition. This is akin to *nixgrep -v.- Specified by:
inverseGrepin interfaceTCharList- Parameters:
condition- a condition to apply to each element in the list- Returns:
- a list of values which do not match the condition.
-
max
public char max()
Description copied from interface:TCharListFinds the maximum value in the list.
-
min
public char min()
Description copied from interface:TCharListFinds the minimum value in the list.
-
sum
public char sum()
Description copied from interface:TCharListCalculates the sum of all the values in the list.
-
subList
public TCharList subList(int fromIndex, int toIndex)
Description copied from interface:TCharListReturns a sublist of this list.
-
add
public void add(char[] vals)
Description copied from interface:TCharListAdds the values in the array vals to the end of the list, in order.
-
add
public void add(char[] vals, int offset, int length)Description copied from interface:TCharListAdds a subset of the values in the array vals to the end of the list, in order.
-
removeAt
public char removeAt(int offset)
Description copied from interface:TCharListRemoves value at a given offset from the list.
-
remove
public void remove(int offset, int length)Description copied from interface:TCharListRemoves length values from the list, starting at offset
-
insert
public void insert(int offset, char value)Description copied from interface:TCharListInserts value into the list at offset. All values including and to the right of offset are shifted to the right.
-
insert
public void insert(int offset, char[] values)Description copied from interface:TCharListInserts the array of values into the list at offset. All values including and to the right of offset are shifted to the right.
-
insert
public void insert(int offset, char[] values, int valOffset, int len)Description copied from interface:TCharListInserts a slice of the array of values into the list at offset. All values including and to the right of offset are shifted to the right.
-
set
public char set(int offset, char val)Description copied from interface:TCharListSets the value at the specified offset.
-
set
public void set(int offset, char[] values)Description copied from interface:TCharListReplace the values in the list starting at offset with the contents of the values array.
-
set
public void set(int offset, char[] values, int valOffset, int length)Description copied from interface:TCharListReplace the values in the list starting at offset with length values from the values array, starting at valOffset.
-
replace
public char replace(int offset, char val)Description copied from interface:TCharListSets the value at the specified offset and returns the previously stored value.
-
transformValues
public void transformValues(TCharFunction function)
Description copied from interface:TCharListTransform each value in the list using the specified function.- Specified by:
transformValuesin interfaceTCharList- Parameters:
function- aTCharFunctionvalue
-
reverse
public void reverse()
Description copied from interface:TCharListReverse the order of the elements in the list.
-
reverse
public void reverse(int from, int to)Description copied from interface:TCharListReverse the order of the elements in the range of the list.
-
shuffle
public void shuffle(java.util.Random rand)
Description copied from interface:TCharListShuffle the elements of the list using the specified random number generator.
-
sort
public void sort()
Description copied from interface:TCharListSort the values in the list (ascending) using the Sun quicksort implementation.
-
sort
public void sort(int fromIndex, int toIndex)Description copied from interface:TCharListSort a slice of the list (ascending) using the Sun quicksort implementation.
-
fill
public void fill(char val)
Description copied from interface:TCharListFills every slot in the list with the specified value.
-
fill
public void fill(int fromIndex, int toIndex, char val)Description copied from interface:TCharListFills a range in the list with the specified value.
-
-