Class AbstractCharList.CharSubList
- java.lang.Object
-
- java.util.AbstractCollection<Character>
-
- org.codelibs.jhighlight.fastutil.chars.AbstractCharCollection
-
- org.codelibs.jhighlight.fastutil.chars.AbstractCharList
-
- org.codelibs.jhighlight.fastutil.chars.AbstractCharList.CharSubList
-
- All Implemented Interfaces:
Serializable
,Comparable<List<? extends Character>>
,Iterable<Character>
,Collection<Character>
,List<Character>
,CharCollection
,CharIterable
,CharList
,CharStack
,Stack<Character>
- Enclosing class:
- AbstractCharList
public static class AbstractCharList.CharSubList extends AbstractCharList implements Serializable
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.codelibs.jhighlight.fastutil.chars.AbstractCharList
AbstractCharList.CharSubList
-
-
Constructor Summary
Constructors Constructor Description CharSubList(CharList l, int from, int to)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
add(char k)
void
add(int index, char k)
boolean
addAll(int index, Collection<? extends Character> c)
boolean
addAll(int index, CharCollection c)
Delegates to a more generic method.boolean
addAll(int index, CharList l)
Delegates to a more generic method.void
addElements(int index, char[] a, int offset, int length)
Adds elements to this type-specific list one-by-one.void
clear()
char
getChar(int index)
void
getElements(int from, char[] a, int offset, int length)
Copies element of this type-specific list into the given array one-by-one.CharListIterator
listIterator(int index)
Returns a type-specific list iterator on the list starting at a given index.boolean
rem(char k)
boolean
remove(Object o)
Delegates torem()
.char
removeChar(int index)
void
removeElements(int from, int to)
Removes elements of this type-specific list one-by-one.char
set(int index, char k)
int
size()
CharList
subList(int from, int to)
Returns a type-specific view of the portion of this list from the indexfrom
, inclusive, to the indexto
, exclusive.-
Methods inherited from class org.codelibs.jhighlight.fastutil.chars.AbstractCharList
add, addAll, addAll, addAll, addElements, charListIterator, charListIterator, charSubList, compareTo, contains, ensureIndex, ensureRestrictedIndex, equals, get, hashCode, indexOf, indexOf, iterator, lastIndexOf, lastIndexOf, listIterator, peek, peekChar, pop, popChar, push, push, remove, set, size, top, topChar, toString
-
Methods inherited from class org.codelibs.jhighlight.fastutil.chars.AbstractCharCollection
add, charIterator, contains, containsAll, containsAll, isEmpty, rem, removeAll, removeAll, retainAll, retainAll, toArray, toArray, toArray, toCharArray, toCharArray
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.codelibs.jhighlight.fastutil.chars.CharCollection
charIterator, containsAll, removeAll, retainAll, toArray, toArray, toCharArray, toCharArray
-
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
-
Methods inherited from interface java.util.List
add, contains, containsAll, isEmpty, removeAll, replaceAll, retainAll, sort, spliterator, toArray, toArray
-
-
-
-
Field Detail
-
l
protected final CharList l
The list this sublist restricts.
-
from
protected final int from
Initial (inclusive) index of this sublist.
-
to
protected int to
Final (exclusive) index of this sublist.
-
-
Constructor Detail
-
CharSubList
public CharSubList(CharList l, int from, int to)
-
-
Method Detail
-
add
public boolean add(char k)
- Specified by:
add
in interfaceCharCollection
- Specified by:
add
in interfaceCharList
- Overrides:
add
in classAbstractCharList
- See Also:
Collection.add(Object)
-
add
public void add(int index, char k)
- Specified by:
add
in interfaceCharList
- Overrides:
add
in classAbstractCharList
- See Also:
List.add(int,Object)
-
addAll
public boolean addAll(int index, Collection<? extends Character> c)
- Specified by:
addAll
in interfaceList<Character>
- Overrides:
addAll
in classAbstractCharList
-
getChar
public char getChar(int index)
- Specified by:
getChar
in interfaceCharList
- See Also:
List.get(int)
-
removeChar
public char removeChar(int index)
- Specified by:
removeChar
in interfaceCharList
- Overrides:
removeChar
in classAbstractCharList
- See Also:
List.remove(int)
-
set
public char set(int index, char k)
- Specified by:
set
in interfaceCharList
- Overrides:
set
in classAbstractCharList
- See Also:
List.set(int,Object)
-
clear
public void clear()
- Specified by:
clear
in interfaceCollection<Character>
- Specified by:
clear
in interfaceList<Character>
- Overrides:
clear
in classAbstractCollection<Character>
-
size
public int size()
- Specified by:
size
in interfaceCollection<Character>
- Specified by:
size
in interfaceList<Character>
- Specified by:
size
in classAbstractCollection<Character>
-
getElements
public void getElements(int from, char[] a, int offset, int length)
Description copied from class:AbstractCharList
Copies element of this type-specific list into the given array one-by-one.This is a trivial iterator-based implementation. It is expected that implementations will override this method with a more optimized version.
- Specified by:
getElements
in interfaceCharList
- Overrides:
getElements
in classAbstractCharList
- Parameters:
from
- the start index (inclusive).a
- the destination array.offset
- the offset into the destination array where to store the first element copied.length
- the number of elements to be copied.
-
removeElements
public void removeElements(int from, int to)
Description copied from class:AbstractCharList
Removes elements of this type-specific list one-by-one.This is a trivial iterator-based implementation. It is expected that implementations will override this method with a more optimized version.
- Specified by:
removeElements
in interfaceCharList
- Overrides:
removeElements
in classAbstractCharList
- Parameters:
from
- the start index (inclusive).to
- the end index (exclusive).
-
addElements
public void addElements(int index, char[] a, int offset, int length)
Description copied from class:AbstractCharList
Adds elements to this type-specific list one-by-one.This is a trivial iterator-based implementation. It is expected that implementations will override this method with a more optimized version.
- Specified by:
addElements
in interfaceCharList
- Overrides:
addElements
in classAbstractCharList
- Parameters:
index
- the index at which to add elements.a
- the array containing the elements.offset
- the offset of the first element to add.length
- the number of elements to add.
-
listIterator
public CharListIterator listIterator(int index)
Description copied from interface:CharList
Returns a type-specific list iterator on the list starting at a given index.- Specified by:
listIterator
in interfaceCharList
- Specified by:
listIterator
in interfaceList<Character>
- Overrides:
listIterator
in classAbstractCharList
- See Also:
List.listIterator(int)
-
subList
public CharList subList(int from, int to)
Description copied from interface:CharList
Returns a type-specific view of the portion of this list from the indexfrom
, inclusive, to the indexto
, exclusive.Note that this specification strengthens the one given in
List.subList(int,int)
.- Specified by:
subList
in interfaceCharList
- Specified by:
subList
in interfaceList<Character>
- Overrides:
subList
in classAbstractCharList
- See Also:
List.subList(int,int)
-
rem
public boolean rem(char k)
Description copied from interface:CharCollection
Note that this method should be calledremove()
, but the clash with the similarly named index-based method in theList
interface forces us to use a distinguished name. For simplicity, the set interfaces reinstatesremove()
.- Specified by:
rem
in interfaceCharCollection
- Overrides:
rem
in classAbstractCharList
- See Also:
Collection.remove(Object)
-
remove
public boolean remove(Object o)
Description copied from class:AbstractCharList
Delegates torem()
.- Specified by:
remove
in interfaceCollection<Character>
- Specified by:
remove
in interfaceList<Character>
- Overrides:
remove
in classAbstractCharList
-
addAll
public boolean addAll(int index, CharCollection c)
Description copied from class:AbstractCharList
Delegates to a more generic method.- Specified by:
addAll
in interfaceCharList
- Overrides:
addAll
in classAbstractCharList
- See Also:
List.add(int,Object)
-
addAll
public boolean addAll(int index, CharList l)
Description copied from class:AbstractCharList
Delegates to a more generic method.- Specified by:
addAll
in interfaceCharList
- Overrides:
addAll
in classAbstractCharList
- See Also:
List.add(int,Object)
-
-