Class MutableArrayCharSlice
java.lang.Object
io.karma.sliced.slice.mutable.impl.AbstractMutableSlice<Character>
io.karma.sliced.slice.mutable.impl.MutableArrayCharSlice
- All Implemented Interfaces:
CharSlice
,MutableCharSlice
,MutableSlice<Character>
,Slice<Character>
,Resettable
,ResettableEnumeration<Character>
,CharView
,View<Character>
,CharSequence
,Iterable<Character>
,Enumeration<Character>
@API(status=INTERNAL)
public final class MutableArrayCharSlice
extends AbstractMutableSlice<Character>
implements MutableCharSlice
- Since:
- 17/08/2022
-
Field Summary
Fields inherited from class io.karma.sliced.slice.mutable.impl.AbstractMutableSlice
offset, size
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription@NotNull Object
clone()
boolean
char
getChar
(int index) Retrieves the character at the given index.int
hashCode()
boolean
iterator()
@NotNull Character
void
reset()
Resets the internal states of this object instance.slice
(int offset, int size) Creates a new sub-slice from this slice instance, with the given index range relative to the start index of this slice instance.char[]
toCharArray
(int offset, int size) Creates a newchar
array with the appropriate size, and copies all values fromstart
toend
into new newly created array usingSystem.arraycopy(Object, int, Object, int, int)
.@NotNull String
toString()
@NotNull CharSlice
Trims all leading whitespace (space, tab, newline etc.) off the original char sequence and returns a newCharSlice
, which only references the non-leading-WS part of the original underlying character sequence.@NotNull CharSlice
Trims all trailing whitespace (space, tab, newline etc.) off the original char sequence and returns a newCharSlice
, which only references the non-trailing-WS part of the original underlying character sequence.Methods inherited from class io.karma.sliced.slice.mutable.impl.AbstractMutableSlice
asSlice, offset, setOffset, setSize, size
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.CharSequence
chars, codePoints, isEmpty
Methods inherited from interface io.karma.sliced.slice.CharSlice
charAt, get, length, split, split, split, split, subSequence, toCharArray, trim
Methods inherited from interface io.karma.sliced.view.CharView
charIterator, compilePattern, matcher, textIterator
Methods inherited from interface java.util.Enumeration
asIterator
Methods inherited from interface java.lang.Iterable
forEach, spliterator
Methods inherited from interface io.karma.sliced.slice.mutable.MutableSlice
setOffset, setSize
Methods inherited from interface io.karma.sliced.slice.Slice
copy, copy, copy, copyArrayList, copyHashSet, forEachIndexed, getOptional, getOrElse, getOrThrow, map, offset, toArray, toArray
Methods inherited from interface io.karma.sliced.view.View
asSlice, contains, containsAll, containsAllRefs, containsRef, contentEquals, contentEquals, copyArrayList, copyHashSet, forAll, forAllIndexed, parallelStream, referencesEqual, referencesEqual, size, stream
-
Constructor Details
-
MutableArrayCharSlice
public MutableArrayCharSlice(char[] ref, int offset, int size)
-
-
Method Details
-
trimLeading
Description copied from interface:CharSlice
Trims all leading whitespace (space, tab, newline etc.) off the original char sequence and returns a newCharSlice
, which only references the non-leading-WS part of the original underlying character sequence.- Specified by:
trimLeading
in interfaceCharSlice
- Returns:
- A new
CharSlice
referencing all non-leading-WS characters of the original slice instance's character sequence.
-
trimTrailing
Description copied from interface:CharSlice
Trims all trailing whitespace (space, tab, newline etc.) off the original char sequence and returns a newCharSlice
, which only references the non-trailing-WS part of the original underlying character sequence.- Specified by:
trimTrailing
in interfaceCharSlice
- Returns:
- A new
CharSlice
referencing all non-trailing-WS characters of the original slice instance's character sequence.
-
toCharArray
public char[] toCharArray(int offset, int size) Description copied from interface:CharSlice
Creates a newchar
array with the appropriate size, and copies all values fromstart
toend
into new newly created array usingSystem.arraycopy(Object, int, Object, int, int)
.- Specified by:
toCharArray
in interfaceCharSlice
- Parameters:
offset
- The index at which the newly created array should begin (relative to the offset of this slice).size
- The size of the newly created array.- Returns:
- A new array containing all elements from
start
toend
.
-
slice
Description copied from interface:Slice
Creates a new sub-slice from this slice instance, with the given index range relative to the start index of this slice instance.- Specified by:
slice
in interfaceSlice<Character>
- Parameters:
offset
- The index at which the newly created slice should begin (relative to the offset of this slice).size
- The size of the newly created slice.- Returns:
- A new slice instance containing the same collection/array reference as this slice instance, but with the given relative index range.
-
getChar
public char getChar(int index) Description copied from interface:CharSlice
Retrieves the character at the given index. -
iterator
-
hasMoreElements
public boolean hasMoreElements()- Specified by:
hasMoreElements
in interfaceEnumeration<Character>
-
nextElement
- Specified by:
nextElement
in interfaceEnumeration<Character>
-
clone
-
reset
public void reset()Description copied from interface:Resettable
Resets the internal states of this object instance.- Specified by:
reset
in interfaceResettable
-
hashCode
public int hashCode() -
equals
-
toString
- Specified by:
toString
in interfaceCharSequence
- Overrides:
toString
in classObject
-