Class MutableCharSeqSlice

java.lang.Object
io.karma.sliced.slice.mutable.impl.AbstractMutableSlice<Character>
io.karma.sliced.slice.mutable.impl.MutableCharSeqSlice
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 MutableCharSeqSlice extends AbstractMutableSlice<Character> implements MutableCharSlice
Since:
14/08/2022
  • Constructor Details

    • MutableCharSeqSlice

      public MutableCharSeqSlice(@NotNull @NotNull CharSequence ref, int start, int end)
  • Method Details

    • trimLeading

      @NotNull public @NotNull CharSlice trimLeading()
      Description copied from interface: CharSlice
      Trims all leading whitespace (space, tab, newline etc.) off the original char sequence and returns a new CharSlice, which only references the non-leading-WS part of the original underlying character sequence.
      Specified by:
      trimLeading in interface CharSlice
      Returns:
      A new CharSlice referencing all non-leading-WS characters of the original slice instance's character sequence.
    • trimTrailing

      @NotNull public @NotNull CharSlice trimTrailing()
      Description copied from interface: CharSlice
      Trims all trailing whitespace (space, tab, newline etc.) off the original char sequence and returns a new CharSlice, which only references the non-trailing-WS part of the original underlying character sequence.
      Specified by:
      trimTrailing in interface CharSlice
      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 new char array with the appropriate size, and copies all values from start to end into new newly created array using System.arraycopy(Object, int, Object, int, int).
      Specified by:
      toCharArray in interface CharSlice
      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 to end.
    • slice

      @NotNull public @NotNull Slice<Character> slice(int offset, int size)
      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 interface Slice<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.
      Specified by:
      getChar in interface CharSlice
      Parameters:
      index - The index of the character to retrieve.
      Returns:
      The character at the given index.
    • iterator

      @NotNull public @NotNull Iterator<Character> iterator()
      Specified by:
      iterator in interface CharView
      Specified by:
      iterator in interface Iterable<Character>
    • hasMoreElements

      public boolean hasMoreElements()
      Specified by:
      hasMoreElements in interface Enumeration<Character>
    • nextElement

      @NotNull public @NotNull Character nextElement()
      Specified by:
      nextElement in interface Enumeration<Character>
    • clone

      @NotNull public @NotNull Object clone()
      Overrides:
      clone in class Object
    • reset

      public void reset()
      Description copied from interface: Resettable
      Resets the internal states of this object instance.
      Specified by:
      reset in interface Resettable
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(@Nullable @Nullable Object obj)
      Overrides:
      equals in class Object
    • toString

      @NotNull public @NotNull String toString()
      Specified by:
      toString in interface CharSequence
      Overrides:
      toString in class Object