Class CharSeq

  • All Implemented Interfaces:
    Foldable<java.lang.Character>, IndexedSeq<java.lang.Character>, Seq<java.lang.Character>, Traversable<java.lang.Character>, Function1<java.lang.Integer,​java.lang.Character>, PartialFunction<java.lang.Integer,​java.lang.Character>, Value<java.lang.Character>, java.io.Serializable, java.lang.CharSequence, java.lang.Comparable<CharSeq>, java.lang.Iterable<java.lang.Character>, java.util.function.Function<java.lang.Integer,​java.lang.Character>

    public final class CharSeq
    extends java.lang.Object
    implements java.lang.CharSequence, IndexedSeq<java.lang.Character>, java.io.Serializable, java.lang.Comparable<CharSeq>
    The CharSeq (read: character sequence) collection essentially is a rich String wrapper having all operations we know from the functional Vavr collections.

    Note:Because CharSeq represents a sequence of primitive characters (i.e. a String), it breaks the Liskov Substitution Principle in the way, that the CharSeq cannot contain null elements.

    See Also:
    Serialized Form
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static interface  CharSeq.CharFunction<R>
      Represents a function that accepts a char-valued argument and produces a result.
      static interface  CharSeq.CharUnaryOperator
      Represents an operation on a single char-valued operand that produces a char-valued result.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.lang.String back  
      private static CharSeq EMPTY  
      private static long serialVersionUID  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private CharSeq​(java.lang.String javaString)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      CharSeq append​(java.lang.Character element)
      Returns a new sequence with the given element appended at the end.
      CharSeq appendAll​(@NonNull java.lang.Iterable<? extends java.lang.Character> elements)
      Returns a new sequence with all elements from the given Iterable appended at the end of this sequence.
      java.util.List<java.lang.Character> asJava()
      Returns an immutable List view of this Seq.
      CharSeq asJava​(@NonNull java.util.function.Consumer<? super java.util.List<java.lang.Character>> action)
      Creates an immutable List view of this Seq and passes it to the given action.
      java.util.List<java.lang.Character> asJavaMutable()
      Returns a mutable List view of this Seq.
      CharSeq asJavaMutable​(@NonNull java.util.function.Consumer<? super java.util.List<java.lang.Character>> action)
      Creates a mutable List view of this Seq and passes it to the given action.
      CharSeq capitalize()
      Converts the first character in this CharSeq to upper case using the rules of the default locale.
      CharSeq capitalize​(java.util.Locale locale)
      Converts the first character in this CharSeq to upper case using the rules of the given Locale.
      char charAt​(int index)
      Returns the char value at the specified index.
      int codePointAt​(int index)
      Returns the character (Unicode code point) at the specified index.
      int codePointBefore​(int index)
      Returns the character (Unicode code point) before the specified index.
      int codePointCount​(int beginIndex, int endIndex)
      Returns the number of Unicode code points in the specified text range of this CharSeq.
      <R> IndexedSeq<R> collect​(@NonNull PartialFunction<? super java.lang.Character,​? extends R> partialFunction)
      Applies a PartialFunction to all elements that are defined for it and collects the results.
      static java.util.stream.Collector<java.lang.Character,​java.util.ArrayList<java.lang.Character>,​CharSeq> collector()
      Returns a Collector which may be used in conjunction with Stream.collect(java.util.stream.Collector) to obtain a CharSeq.
      IndexedSeq<CharSeq> combinations()
      Returns a sequence containing all combinations of elements from this sequence, for all sizes from 0 to length().
      IndexedSeq<CharSeq> combinations​(int k)
      Returns all subsets of this sequence containing exactly k distinct elements, i.e., the k-combinations of this sequence.
      int compareTo​(CharSeq anotherString)
      Compares two strings lexicographically.
      int compareToIgnoreCase​(CharSeq str)
      Compares two strings lexicographically, ignoring case differences.
      CharSeq concat​(CharSeq str)
      Concatenates the specified string to the end of this string.
      boolean contains​(java.lang.CharSequence s)
      Returns true if and only if this string contains the specified sequence of char values.
      boolean contentEquals​(java.lang.CharSequence cs)
      Compares this string to the specified CharSequence.
      boolean contentEquals​(java.lang.StringBuffer sb)
      Compares this string to the specified StringBuffer.
      Iterator<CharSeq> crossProduct​(int power)
      Returns the n-ary Cartesian power (cross product) of this sequence.
      java.lang.Byte decodeByte()
      Decodes this CharSeq into a Byte by calling Byte.decode(String).
      java.lang.Integer decodeInteger()
      Decodes this CharSeq into an Integer by calling Integer.decode(String).
      java.lang.Long decodeLong()
      Decodes this CharSeq into a Long by calling Long.decode(String).
      java.lang.Short decodeShort()
      Decodes this CharSeq into a Short by calling Short.decode(String).
      CharSeq distinct()
      Returns a new Traversable containing the elements of this instance with all duplicates removed.
      CharSeq distinctBy​(@NonNull java.util.Comparator<? super java.lang.Character> comparator)
      Returns a new Traversable containing the elements of this instance without duplicates, as determined by the given comparator.
      <U> CharSeq distinctBy​(@NonNull java.util.function.Function<? super java.lang.Character,​? extends U> keyExtractor)
      Returns a new Traversable containing the elements of this instance without duplicates, based on keys extracted from elements using keyExtractor.
      CharSeq distinctByKeepLast​(@NonNull java.util.Comparator<? super java.lang.Character> comparator)
      Returns a sequence with duplicate elements removed, as determined by the provided comparator.
      <U> CharSeq distinctByKeepLast​(@NonNull java.util.function.Function<? super java.lang.Character,​? extends U> keyExtractor)
      Returns a sequence with duplicates removed based on a key extracted from each element.
      CharSeq drop​(int n)
      Returns a new Traversable without the first n elements, or an empty instance if this contains fewer than n elements.
      CharSeq dropRight​(int n)
      Returns a new Traversable without the last n elements, or an empty instance if this contains fewer than n elements.
      CharSeq dropRightUntil​(@NonNull java.util.function.Predicate<? super java.lang.Character> predicate)
      Drops elements from the end of the sequence until an element satisfies the given predicate.
      CharSeq dropRightWhile​(@NonNull java.util.function.Predicate<? super java.lang.Character> predicate)
      Drops elements from the end of the sequence while the given predicate holds.
      CharSeq dropUntil​(@NonNull java.util.function.Predicate<? super java.lang.Character> predicate)
      Returns a new Traversable starting from the first element that satisfies the given predicate, dropping all preceding elements.
      CharSeq dropWhile​(@NonNull java.util.function.Predicate<? super java.lang.Character> predicate)
      Returns a new Traversable starting from the first element that does not satisfy the given predicate, dropping all preceding elements.
      static CharSeq empty()
      Returns the empty CharSeq.
      boolean endsWith​(CharSeq suffix)
      Tests if this string ends with the specified suffix.
      boolean equals​(java.lang.Object o)
      Determines whether this collection is equal to the given object.
      boolean equalsIgnoreCase​(CharSeq anotherString)
      Compares this CharSeq to another CharSeq, ignoring case considerations.
      static CharSeq fill​(int n, java.util.function.Supplier<? extends java.lang.Character> s)
      Returns a CharSeq containing n values supplied by a given Supplier s.
      CharSeq filter​(@NonNull java.util.function.Predicate<? super java.lang.Character> predicate)
      Returns a new traversable containing only the elements that satisfy the given predicate.
      <U> IndexedSeq<U> flatMap​(@NonNull java.util.function.Function<? super java.lang.Character,​? extends java.lang.Iterable<? extends U>> mapper)
      Transforms each element of this Traversable into an Iterable of elements and flattens the resulting iterables into a single Traversable.
      CharSeq flatMapChars​(@NonNull CharSeq.CharFunction<? extends java.lang.CharSequence> mapper)
      FlatMaps this CharSeq to a new CharSeq by applying a CharFunction to each character, which returns a CharSequence, and concatenating the results.
      java.lang.Character get​(int index)
      Returns the element at the specified index.
      byte[] getBytes()
      Encodes this CharSeq into a sequence of bytes using the platform's default charset, storing the result into a new byte array.
      byte[] getBytes​(java.lang.String charsetName)
      Encodes this CharSeq into a sequence of bytes using the named charset, storing the result into a new byte array.
      byte[] getBytes​(java.nio.charset.Charset charset)
      Encodes this CharSeq into a sequence of bytes using the given charset, storing the result into a new byte array.
      void getChars​(int srcBegin, int srcEnd, char[] dst, int dstBegin)
      Copies characters from this string into the destination character array.
      <C> Map<C,​CharSeq> groupBy​(@NonNull java.util.function.Function<? super java.lang.Character,​? extends C> classifier)
      Groups elements of this Traversable based on a classifier function.
      Iterator<CharSeq> grouped​(int size)
      Splits this Traversable into consecutive blocks of the given size.
      boolean hasDefiniteSize()
      Indicates whether this Traversable has a known finite size.
      int hashCode()
      Returns the hash code of this collection.
      java.lang.Character head()
      Returns the first element of this non-empty Traversable.
      int indexOf​(int ch)
      Returns the index within this string of the first occurrence of the specified character.
      int indexOf​(int ch, int fromIndex)
      Returns the index within this string of the first occurrence of the specified character, starting the search at the specified index.
      int indexOf​(CharSeq str)
      Returns the index within this string of the first occurrence of the specified substring.
      int indexOf​(CharSeq str, int fromIndex)
      Returns the index within this string of the first occurrence of the specified substring, starting at the specified index.
      int indexOf​(java.lang.Character element, int from)
      Returns the index of the first occurrence of the given element, starting at the specified index, or -1 if this sequence does not contain the element.
      (package private) Option<java.lang.Integer> indexOfOption​(int ch)
      Returns the index of the first occurrence of the given element as an Option.
      (package private) Option<java.lang.Integer> indexOfOption​(int ch, int fromIndex)
      Returns the index of the first occurrence of the given element as an Option, starting the search at the specified index.
      Option<java.lang.Integer> indexOfOption​(CharSeq str)
      Returns the index of the first occurrence of the given element as an Option.
      Option<java.lang.Integer> indexOfOption​(CharSeq str, int fromIndex)
      Returns the index of the first occurrence of the given element as an Option, starting the search at the specified index.
      CharSeq init()
      Returns all elements of this Traversable except the last one.
      Option<CharSeq> initOption()
      Returns all elements of this Traversable except the last one, wrapped in an Option.
      CharSeq insert​(int index, java.lang.Character element)
      Returns a new sequence with the given element inserted at the specified index.
      CharSeq insertAll​(int index, @NonNull java.lang.Iterable<? extends java.lang.Character> elements)
      Returns a new sequence with the given elements inserted at the specified index.
      CharSeq intersperse​(java.lang.Character element)
      Returns a new sequence where the given element is inserted between all elements of this sequence.
      boolean isAsync()
      A CharSeq is computed synchronously.
      boolean isEmpty()
      Checks if this Traversable contains no elements.
      boolean isLazy()
      A CharSeq is computed eagerly.
      boolean isTraversableAgain()
      Checks if this Traversable can be traversed multiple times without side effects.
      @NonNull Iterator<java.lang.Character> iterator()
      Returns an iterator over the elements of this Traversable, implemented via Traversable.head() and Traversable.tail().
      int lastIndexOf​(int ch)
      Returns the index within this string of the last occurrence of the specified character.
      int lastIndexOf​(int ch, int fromIndex)
      Returns the index within this string of the last occurrence of the specified character, searching backward starting at the specified index.
      int lastIndexOf​(CharSeq str)
      Returns the index within this string of the last occurrence of the specified substring.
      int lastIndexOf​(CharSeq str, int fromIndex)
      Returns the index within this string of the last occurrence of the specified substring, searching backward starting at the specified index.
      int lastIndexOf​(java.lang.Character element, int end)
      Returns the index of the last occurrence of the given element at or before the specified end index, or -1 if this sequence does not contain the element.
      (package private) Option<java.lang.Integer> lastIndexOfOption​(int ch)
      Returns the index of the last occurrence of the given element as an Option.
      Option<java.lang.Integer> lastIndexOfOption​(int ch, int fromIndex)
      Returns the index of the last occurrence of the given element as an Option, starting the search at the specified index.
      Option<java.lang.Integer> lastIndexOfOption​(CharSeq str)
      Returns the index of the last occurrence of the given element as an Option.
      Option<java.lang.Integer> lastIndexOfOption​(CharSeq str, int fromIndex)
      Returns the index of the last occurrence of the given element as an Option, starting the search at the specified index.
      CharSeq leftPadTo​(int length, java.lang.Character element)
      Returns a new sequence with this sequence padded on the left with the given element until the specified target length is reached.
      int length()
      Returns the length of this string.
      <U> IndexedSeq<U> map​(@NonNull java.util.function.Function<? super java.lang.Character,​? extends U> mapper)
      Transforms the elements of this Traversable to a new type, preserving order if defined.
      CharSeq mapChars​(CharSeq.CharUnaryOperator mapper)
      Maps this CharSeq to a new CharSeq by applying a CharUnaryOperator to each character.
      <U> IndexedSeq<U> mapTo​(U value)
      Maps the underlying value to another fixed value.
      IndexedSeq<java.lang.Void> mapToVoid()
      Maps the underlying value to Void
      boolean matches​(java.lang.String regex)
      Tells whether or not this string matches the given regular expression.
      java.lang.String mkString()
      Concatenates the string representations of all elements in this Traversable.
      static CharSeq of​(char character)
      Returns a singleton CharSeq, i.e.
      static CharSeq of​(char @NonNull ... characters)
      Creates a String of the given characters.
      static CharSeq of​(@NonNull java.lang.CharSequence sequence)
      Creates a String of CharSequence.
      static CharSeq ofAll​(@NonNull java.lang.Iterable<? extends java.lang.Character> elements)
      Creates a String of the given elements.
      int offsetByCodePoints​(int index, int codePointOffset)
      Returns the index within this CharSeq that is offset from the given index by codePointOffset code points.
      CharSeq orElse​(@NonNull java.util.function.Supplier<? extends java.lang.Iterable<? extends java.lang.Character>> supplier)
      Returns this Traversable if it is non-empty; otherwise, returns the result of evaluating the given supplier.
      CharSeq orElse​(java.lang.Iterable<? extends java.lang.Character> other)
      Returns this Traversable if it is non-empty; otherwise, returns the given alternative.
      private static java.lang.StringBuilder padding​(char element, int limit)  
      CharSeq padTo​(int length, java.lang.Character element)
      Returns a new sequence with this sequence padded on the right with the given element until the specified target length is reached.
      boolean parseBoolean()
      Parses this CharSeq as a boolean by calling Boolean.parseBoolean(String).
      byte parseByte()
      Parses this CharSeq as a signed decimal byte by calling Byte.parseByte(String).
      byte parseByte​(int radix)
      Parses this CharSeq as a signed byte in the specified radix by calling Byte.parseByte(String, int).
      double parseDouble()
      Parses this CharSeq as a double by calling Double.parseDouble(String).
      float parseFloat()
      Parses this CharSeq as a float by calling Float.parseFloat(String).
      int parseInt()
      Parses this CharSeq as a signed decimal int by calling Integer.parseInt(String).
      int parseInt​(int radix)
      Parses this CharSeq as a signed int in the specified radix by calling Integer.parseInt(String, int).
      long parseLong()
      Parses this CharSeq as a signed decimal long by calling Long.parseLong(String).
      long parseLong​(int radix)
      Parses this CharSeq as a signed long in the specified radix by calling Long.parseLong(String, int).
      short parseShort()
      Parses this CharSeq as a signed decimal short by calling Short.parseShort(String).
      short parseShort​(int radix)
      Parses this CharSeq as a signed short in the specified radix by calling Short.parseShort(String, int).
      int parseUnsignedInt()
      Parses this CharSeq as a unsigned decimal int by calling Integer.parseUnsignedInt(String).
      int parseUnsignedInt​(int radix)
      Parses this CharSeq as a unsigned int in the specified radix by calling Integer.parseUnsignedInt(String, int).
      long parseUnsignedLong()
      Parses this CharSeq as a unsigned decimal long by calling Long.parseUnsignedLong(String).
      long parseUnsignedLong​(int radix)
      Parses this CharSeq as a unsigned long in the specified radix by calling Long.parseUnsignedLong(String, int).
      Tuple2<CharSeq,​CharSeq> partition​(@NonNull java.util.function.Predicate<? super java.lang.Character> predicate)
      Splits this Traversable into two partitions according to a predicate.
      CharSeq patch​(int from, @NonNull java.lang.Iterable<? extends java.lang.Character> that, int replaced)
      Returns a new sequence in which a slice of elements in this sequence is replaced by the elements of another sequence.
      CharSeq peek​(@NonNull java.util.function.Consumer<? super java.lang.Character> action)
      Performs the given action on the first element if this is an eager implementation.
      IndexedSeq<CharSeq> permutations()
      Returns all unique permutations of this sequence.
      CharSeq prepend​(java.lang.Character element)
      Returns a new sequence with the given element prepended to this sequence.
      CharSeq prependAll​(@NonNull java.lang.Iterable<? extends java.lang.Character> elements)
      Returns a new sequence with all given elements prepended to this sequence.
      static CharSeq range​(char from, char toExclusive)
      Creates a CharSeq starting from character from, extending to character toExclusive - 1.
      static CharSeq rangeBy​(char from, char toExclusive, int step)
      Creates a CharSeq starting from character from, extending to character toExclusive - 1, with step.
      static CharSeq rangeClosed​(char from, char toInclusive)
      Creates a CharSeq starting from character from, extending to character toInclusive.
      static CharSeq rangeClosedBy​(char from, char toInclusive, int step)
      Creates a CharSeq starting from character from, extending to character toInclusive, with step.
      private java.lang.Object readResolve()  
      boolean regionMatches​(boolean ignoreCase, int toffset, CharSeq other, int ooffset, int len)
      Tests if two string regions are equal.
      boolean regionMatches​(int toffset, CharSeq other, int ooffset, int len)
      Tests if two string regions are equal.
      CharSeq reject​(@NonNull java.util.function.Predicate<? super java.lang.Character> predicate)
      Returns a new traversable containing only the elements that do not satisfy the given predicate.
      CharSeq remove​(java.lang.Character element)
      Returns a new sequence with the first occurrence of the given element removed.
      CharSeq removeAll​(@NonNull java.lang.Iterable<? extends java.lang.Character> elements)
      Returns a new sequence with all occurrences of the given elements removed.
      CharSeq removeAll​(@NonNull java.util.function.Predicate<? super java.lang.Character> predicate)
      Deprecated.
      CharSeq removeAll​(java.lang.Character element)
      Returns a new sequence with all occurrences of the given element removed.
      CharSeq removeAt​(int index)
      Returns a new sequence with the element at the specified position removed.
      CharSeq removeFirst​(@NonNull java.util.function.Predicate<java.lang.Character> predicate)
      Returns a new sequence with the first element that satisfies the given predicate removed.
      CharSeq removeLast​(@NonNull java.util.function.Predicate<java.lang.Character> predicate)
      Returns a new sequence with the last element that satisfies the given predicate removed.
      static CharSeq repeat​(char character, int times)
      Repeats a character times times.
      CharSeq repeat​(int times)
      Repeats this CharSeq times times.
      CharSeq replace​(java.lang.Character currentElement, java.lang.Character newElement)
      Replaces the first occurrence of currentElement with newElement, if it exists.
      CharSeq replace​(java.lang.CharSequence target, java.lang.CharSequence replacement)
      Replaces each substring of this string that matches the literal target sequence with the specified literal replacement sequence.
      CharSeq replaceAll​(java.lang.Character currentElement, java.lang.Character newElement)
      Replaces all occurrences of currentElement with newElement.
      CharSeq replaceAll​(java.lang.String regex, java.lang.String replacement)
      Replaces each substring of this string that matches the given regular expression with the given replacement.
      CharSeq replaceFirst​(java.lang.String regex, java.lang.String replacement)
      Replaces the first substring of this string that matches the given regular expression with the given replacement.
      CharSeq retainAll​(@NonNull java.lang.Iterable<? extends java.lang.Character> elements)
      Retains only the elements from this Traversable that are contained in the given elements.
      CharSeq reverse()
      Returns a new sequence with the order of elements reversed.
      CharSeq rotateLeft​(int n)
      Returns a new sequence with the elements circularly rotated to the left by the specified distance.
      CharSeq rotateRight​(int n)
      Returns a new sequence with the elements circularly rotated to the right by the specified distance.
      CharSeq scan​(java.lang.Character zero, @NonNull java.util.function.BiFunction<? super java.lang.Character,​? super java.lang.Character,​? extends java.lang.Character> operation)
      Computes a prefix scan of the elements of this Traversable.
      <U> IndexedSeq<U> scanLeft​(U zero, @NonNull java.util.function.BiFunction<? super U,​? super java.lang.Character,​? extends U> operation)
      Produces a collection containing cumulative results of applying the operator from left to right.
      <U> IndexedSeq<U> scanRight​(U zero, @NonNull java.util.function.BiFunction<? super java.lang.Character,​? super U,​? extends U> operation)
      Produces a collection containing cumulative results of applying the operator from right to left.
      CharSeq shuffle()
      Returns a new sequence with the elements randomly shuffled.
      CharSeq slice​(int beginIndex, int endIndex)
      Returns a subsequence (slice) of this sequence, starting at beginIndex (inclusive) and ending at endIndex (exclusive).
      Iterator<CharSeq> slideBy​(@NonNull java.util.function.Function<? super java.lang.Character,​?> classifier)
      Partitions this Traversable into consecutive non-overlapping windows according to a classification function.
      Iterator<CharSeq> sliding​(int size)
      Slides a window of a given size over this Traversable with a step size of 1.
      Iterator<CharSeq> sliding​(int size, int step)
      Slides a window of a specific size with a given step over this Traversable.
      <U> CharSeq sortBy​(@NonNull java.util.Comparator<? super U> comparator, java.util.function.Function<? super java.lang.Character,​? extends U> mapper)
      Returns a new sequence sorted by comparing elements in a different domain defined by the given mapper, using the provided comparator.
      <U extends java.lang.Comparable<? super U>>
      CharSeq
      sortBy​(@NonNull java.util.function.Function<? super java.lang.Character,​? extends U> mapper)
      Returns a new sequence sorted by comparing elements in a different domain defined by the given mapper.
      CharSeq sorted()
      Returns a new sequence with elements sorted according to their natural order.
      CharSeq sorted​(@NonNull java.util.Comparator<? super java.lang.Character> comparator)
      Returns a new sequence with elements sorted according to the given Comparator.
      Tuple2<CharSeq,​CharSeq> span​(@NonNull java.util.function.Predicate<? super java.lang.Character> predicate)
      Splits this Traversable into a prefix and remainder according to the given predicate.
      Seq<CharSeq> split​(java.lang.String regex)
      Splits this string around matches of the given regular expression.
      Seq<CharSeq> split​(java.lang.String regex, int limit)
      Splits this string around matches of the given regular expression.
      Tuple2<CharSeq,​CharSeq> splitAt​(int n)
      Splits this sequence at the specified index.
      Tuple2<CharSeq,​CharSeq> splitAt​(@NonNull java.util.function.Predicate<? super java.lang.Character> predicate)
      Splits this sequence at the first element satisfying the given predicate.
      Tuple2<CharSeq,​CharSeq> splitAtInclusive​(@NonNull java.util.function.Predicate<? super java.lang.Character> predicate)
      Splits this sequence at the first element satisfying the given predicate, including the element in the first part.
      private Tuple2<CharSeq,​CharSeq> splitByBuilder​(java.lang.StringBuilder sb)  
      boolean startsWith​(@NonNull java.lang.Iterable<? extends java.lang.Character> that, int offset)
      Tests whether this sequence contains the given sequence starting at the specified index.
      boolean startsWith​(CharSeq prefix)
      Tests if this string starts with the specified prefix.
      boolean startsWith​(CharSeq prefix, int toffset)
      Tests if the substring of this string beginning at the specified index starts with the specified prefix.
      java.lang.String stringPrefix()
      Returns the name of this Value type, which is used by toString().
      CharSeq subSequence​(int beginIndex)
      Returns a Seq that is a subsequence of this sequence, starting from the specified beginIndex and extending to the end of this sequence.
      CharSeq subSequence​(int beginIndex, int endIndex)
      Returns a Seq that is a subsequence of this sequence, starting from the specified beginIndex (inclusive) and ending at endIndex (exclusive).
      CharSeq substring​(int beginIndex)
      Returns a string that is a substring of this string.
      CharSeq substring​(int beginIndex, int endIndex)
      Returns a string that is a substring of this string.
      static CharSeq tabulate​(int n, @NonNull java.util.function.Function<? super java.lang.Integer,​? extends java.lang.Character> f)
      Returns a CharSeq containing n values of a given Function f over a range of integer values from 0 to n - 1.
      CharSeq tail()
      Returns a new Traversable without its first element.
      Option<CharSeq> tailOption()
      Returns a new Traversable without its first element as an Option.
      CharSeq take​(int n)
      Returns the first n elements of this Traversable, or all elements if n exceeds the length.
      CharSeq takeRight​(int n)
      Returns the last n elements of this Traversable, or all elements if n exceeds the length.
      CharSeq takeRightUntil​(@NonNull java.util.function.Predicate<? super java.lang.Character> predicate)
      Takes elements from the end of the sequence until an element satisfies the given predicate.
      CharSeq takeRightWhile​(@NonNull java.util.function.Predicate<? super java.lang.Character> predicate)
      Takes elements from the end of the sequence while the given predicate holds.
      CharSeq takeUntil​(@NonNull java.util.function.Predicate<? super java.lang.Character> predicate)
      Takes elements from this Traversable until the given predicate holds for an element.
      CharSeq takeWhile​(@NonNull java.util.function.Predicate<? super java.lang.Character> predicate)
      Takes elements from this Traversable while the given predicate holds.
      java.lang.Boolean toBoolean()
      Converts this CharSeq to a Boolean by calling Boolean.valueOf(String).
      java.lang.Byte toByte()
      Converts this CharSeq to a Byte by calling Byte.valueOf(String).
      java.lang.Byte toByte​(int radix)
      Converts this CharSeq to a Byte in the specified radix by calling Byte.valueOf(String, int).
      char[] toCharArray()
      Converts this string to a new character array.
      java.lang.Double toDouble()
      Converts this CharSeq to a Double by calling Double.valueOf(String).
      java.lang.Float toFloat()
      Converts this CharSeq to a Float by calling Float.valueOf(String).
      java.lang.Integer toInteger()
      Converts this CharSeq to an Integer by calling Integer.valueOf(String).
      java.lang.Integer toInteger​(int radix)
      Converts this CharSeq to an Integer in the specified radix by calling Integer.valueOf(String, int).
      java.lang.Character[] toJavaArray()
      Converts this to a Java array with component type Object
      java.lang.Long toLong()
      Converts this CharSeq to a Long by calling Long.valueOf(String).
      java.lang.Long toLong​(int radix)
      Converts this CharSeq to a Long in the specified radix by calling Long.valueOf(String, int).
      CharSeq toLowerCase()
      Converts all of the characters in this CharSeq to lower case using the rules of the default locale.
      CharSeq toLowerCase​(java.util.Locale locale)
      Converts all of the characters in this CharSeq to lower case using the rules of the given Locale.
      java.lang.Short toShort()
      Converts this CharSeq to a Short by calling Short.valueOf(String).
      java.lang.Short toShort​(int radix)
      Converts this CharSeq to a Short in the specified radix by calling Short.valueOf(String, int).
      java.lang.String toString()
      Returns a string containing the characters in this sequence in the same order as this sequence.
      CharSeq toUpperCase()
      Converts all of the characters in this CharSeq to upper case using the rules of the default locale.
      CharSeq toUpperCase​(java.util.Locale locale)
      Converts all of the characters in this CharSeq to upper case using the rules of the given Locale.
      <U> U transform​(java.util.function.Function<? super CharSeq,​? extends U> f)
      Transforms this CharSeq.
      CharSeq trim()
      Returns a string whose value is this string, with any leading and trailing whitespace removed.
      static CharSeq unfold​(java.lang.Character seed, java.util.function.Function<? super java.lang.Character,​Option<Tuple2<? extends java.lang.Character,​? extends java.lang.Character>>> f)
      Creates a CharSeq from a seed value and a function.
      static <T> CharSeq unfoldLeft​(T seed, java.util.function.Function<? super T,​Option<Tuple2<? extends T,​? extends java.lang.Character>>> f)
      Creates a CharSeq from a seed value and a function.
      static <T> CharSeq unfoldRight​(T seed, java.util.function.Function<? super T,​Option<Tuple2<? extends java.lang.Character,​? extends T>>> f)
      Creates a CharSeq from a seed value and a function.
      <T1,​T2>
      Tuple2<IndexedSeq<T1>,​IndexedSeq<T2>>
      unzip​(@NonNull java.util.function.Function<? super java.lang.Character,​Tuple2<? extends T1,​? extends T2>> unzipper)
      Unzips the elements of this Traversable by mapping each element to a pair and splitting them into two separate Traversable collections.
      <T1,​T2,​T3>
      Tuple3<IndexedSeq<T1>,​IndexedSeq<T2>,​IndexedSeq<T3>>
      unzip3​(@NonNull java.util.function.Function<? super java.lang.Character,​Tuple3<? extends T1,​? extends T2,​? extends T3>> unzipper)
      Unzips the elements of this Traversable by mapping each element to a triple and splitting them into three separate Traversable collections.
      CharSeq update​(int index, @NonNull java.util.function.Function<? super java.lang.Character,​? extends java.lang.Character> updater)
      Returns a new Seq with the element at the specified index updated using the given function.
      CharSeq update​(int index, java.lang.Character element)
      Returns a new Seq with the element at the specified index replaced by the given value.
      <U> IndexedSeq<Tuple2<java.lang.Character,​U>> zip​(@NonNull java.lang.Iterable<? extends U> that)
      Returns a Traversable formed by pairing elements of this Traversable with elements of another Iterable.
      <U> IndexedSeq<Tuple2<java.lang.Character,​U>> zipAll​(@NonNull java.lang.Iterable<? extends U> that, java.lang.Character thisElem, U thatElem)
      Returns a Traversable formed by pairing elements of this Traversable with elements of another Iterable, filling in placeholder elements when one collection is shorter than the other.
      <U,​R>
      IndexedSeq<R>
      zipWith​(@NonNull java.lang.Iterable<? extends U> that, java.util.function.BiFunction<? super java.lang.Character,​? super U,​? extends R> mapper)
      Returns a Traversable by combining elements of this Traversable with elements of another Iterable using a mapping function.
      IndexedSeq<Tuple2<java.lang.Character,​java.lang.Integer>> zipWithIndex()
      Zips this Traversable with its indices, starting at 0.
      <U> IndexedSeq<U> zipWithIndex​(@NonNull java.util.function.BiFunction<? super java.lang.Character,​? super java.lang.Integer,​? extends U> mapper)
      Zips this Traversable with its indices and maps the resulting pairs using the provided mapper.
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.lang.CharSequence

        chars, codePoints
    • Field Detail

      • EMPTY

        private static final CharSeq EMPTY
      • back

        private final java.lang.String back
    • Constructor Detail

      • CharSeq

        private CharSeq​(java.lang.String javaString)
    • Method Detail

      • empty

        public static CharSeq empty()
        Returns the empty CharSeq.
        Returns:
        An empty CharSeq
      • collector

        public static java.util.stream.Collector<java.lang.Character,​java.util.ArrayList<java.lang.Character>,​CharSeq> collector()
        Returns a Collector which may be used in conjunction with Stream.collect(java.util.stream.Collector) to obtain a CharSeq.
        Returns:
        A CharSeq Collector.
      • of

        public static CharSeq of​(@NonNull java.lang.CharSequence sequence)
        Creates a String of CharSequence.
        Parameters:
        sequence - CharSequence instance.
        Returns:
        A new CharSeq
      • of

        public static CharSeq of​(char character)
        Returns a singleton CharSeq, i.e. a CharSeq of one character.
        Parameters:
        character - A character.
        Returns:
        A new CharSeq instance containing the given element
      • of

        public static CharSeq of​(char @NonNull ... characters)
        Creates a String of the given characters.
        Parameters:
        characters - Zero or more characters.
        Returns:
        A string containing the given characters in the same order.
        Throws:
        java.lang.NullPointerException - if elements is null
      • ofAll

        public static CharSeq ofAll​(@NonNull java.lang.Iterable<? extends java.lang.Character> elements)
        Creates a String of the given elements.

        The resulting string has the same iteration order as the given iterable of elements if the iteration order of the elements is stable.

        Parameters:
        elements - An Iterable of elements.
        Returns:
        A string containing the given elements in the same order.
        Throws:
        java.lang.NullPointerException - if elements is null or elements contains null
      • tabulate

        public static CharSeq tabulate​(int n,
                                       @NonNull java.util.function.Function<? super java.lang.Integer,​? extends java.lang.Character> f)
        Returns a CharSeq containing n values of a given Function f over a range of integer values from 0 to n - 1.
        Parameters:
        n - The number of elements in the CharSeq
        f - The Function computing element values
        Returns:
        A CharSeq consisting of elements f(0),f(1), ..., f(n - 1)
        Throws:
        java.lang.NullPointerException - if f is null
      • fill

        public static CharSeq fill​(int n,
                                   java.util.function.Supplier<? extends java.lang.Character> s)
        Returns a CharSeq containing n values supplied by a given Supplier s.
        Parameters:
        n - The number of elements in the CharSeq
        s - The Supplier computing element values
        Returns:
        A CharSeq of size n, where each element contains the result supplied by s.
        Throws:
        java.lang.NullPointerException - if s is null
      • range

        public static CharSeq range​(char from,
                                    char toExclusive)
        Creates a CharSeq starting from character from, extending to character toExclusive - 1.

        Examples:

         
         CharSeq.range('a', 'c')  // = "ab"
         CharSeq.range('c', 'a')  // = ""
         
         
        Parameters:
        from - the first character
        toExclusive - the successor of the last character
        Returns:
        a range of characters as specified or the empty range if from >= toExclusive
      • rangeBy

        public static CharSeq rangeBy​(char from,
                                      char toExclusive,
                                      int step)
        Creates a CharSeq starting from character from, extending to character toExclusive - 1, with step.

        Examples:

         
         CharSeq.rangeBy('a', 'e', 2)  // = "ac"
         CharSeq.rangeBy('e', 'a', -2) // = "ec"
         
         
        Parameters:
        from - the first character
        toExclusive - the successor of the last character
        step - the step
        Returns:
        a range of characters from from (inclusive) to toExclusive (exclusive) by step, or an empty CharSeq if the parameters would result in an empty range
      • rangeClosed

        public static CharSeq rangeClosed​(char from,
                                          char toInclusive)
        Creates a CharSeq starting from character from, extending to character toInclusive.

        Examples:

         
         CharSeq.rangeClosed('a', 'c')  // = "abc"
         CharSeq.rangeClosed('c', 'a')  // = ""
         
         
        Parameters:
        from - the first character
        toInclusive - the last character
        Returns:
        a range of characters as specified or the empty range if from > toInclusive
      • rangeClosedBy

        public static CharSeq rangeClosedBy​(char from,
                                            char toInclusive,
                                            int step)
        Creates a CharSeq starting from character from, extending to character toInclusive, with step.

        Examples:

         
         CharSeq.rangeClosedBy('a', 'c', 1)  // = ('a', 'b', 'c')
         CharSeq.rangeClosedBy('a', 'd', 2)  // = ('a', 'c')
         CharSeq.rangeClosedBy('d', 'a', -2) // = ('d', 'b')
         CharSeq.rangeClosedBy('d', 'a', 2)  // = ()
         
         
        Parameters:
        from - the first character
        toInclusive - the last character
        step - the step
        Returns:
        a range of characters as specified or the empty range if step * (from - toInclusive) > 0.
        Throws:
        java.lang.IllegalArgumentException - if step is zero
      • unfoldRight

        public static <T> CharSeq unfoldRight​(T seed,
                                              java.util.function.Function<? super T,​Option<Tuple2<? extends java.lang.Character,​? extends T>>> f)
        Creates a CharSeq from a seed value and a function. The function takes the seed at first. The function should return None when it's done generating the CharSeq, otherwise Some Tuple of the element for the next call and the value to add to the resulting CharSeq.

        Example:

         
         CharSeq.unfoldRight('j', x -> x == 'a'
                     ? Option.none()
                     : Option.of(new Tuple2<>(new Character(x), (char)(x-1))));
         // CharSeq.of("jihgfedcb"))
         
         
        Type Parameters:
        T - type of seeds
        Parameters:
        seed - the start value for the iteration
        f - the function to get the next step of the iteration
        Returns:
        a CharSeq with the values built up by the iteration
        Throws:
        java.lang.NullPointerException - if f is null
      • unfoldLeft

        public static <T> CharSeq unfoldLeft​(T seed,
                                             java.util.function.Function<? super T,​Option<Tuple2<? extends T,​? extends java.lang.Character>>> f)
        Creates a CharSeq from a seed value and a function. The function takes the seed at first. The function should return None when it's done generating the CharSeq, otherwise Some Tuple of the value to add to the resulting CharSeq and the element for the next call.

        Example:

         
         CharSeq.unfoldLeft('j', x -> x == 'a'
                     ? Option.none()
                     : Option.of(new Tuple2<>((char)(x-1), new Character(x))));
         // CharSeq.of("bcdefghij"))
         
         
        Type Parameters:
        T - type of seeds
        Parameters:
        seed - the start value for the iteration
        f - the function to get the next step of the iteration
        Returns:
        a CharSeq with the values built up by the iteration
        Throws:
        java.lang.NullPointerException - if f is null
      • unfold

        public static CharSeq unfold​(java.lang.Character seed,
                                     java.util.function.Function<? super java.lang.Character,​Option<Tuple2<? extends java.lang.Character,​? extends java.lang.Character>>> f)
        Creates a CharSeq from a seed value and a function. The function takes the seed at first. The function should return None when it's done generating the CharSeq, otherwise Some Tuple of the value to add to the resulting CharSeq and the element for the next call.

        Example:

         
         CharSeq.unfold('j', x -> x == 'a'
                        ? Option.none()
                        : Option.of(new Tuple2<>((char)(x-1), new Character(x))));
         // CharSeq.of("bcdefghij"))
         
         
        Parameters:
        seed - the start value for the iteration
        f - the function to get the next step of the iteration
        Returns:
        a CharSeq with the values built up by the iteration
        Throws:
        java.lang.NullPointerException - if f is null
      • splitByBuilder

        private Tuple2<CharSeq,​CharSeq> splitByBuilder​(java.lang.StringBuilder sb)
      • repeat

        public static CharSeq repeat​(char character,
                                     int times)
        Repeats a character times times.
        Parameters:
        character - A character
        times - Repetition count
        Returns:
        A CharSeq representing character * times
      • repeat

        public CharSeq repeat​(int times)
        Repeats this CharSeq times times.

        Example: CharSeq.of("ja").repeat(13) = "jajajajajajajajajajajajaja"

        Parameters:
        times - Repetition count
        Returns:
        A CharSeq representing this * times
      • append

        public CharSeq append​(java.lang.Character element)
        Description copied from interface: Seq
        Returns a new sequence with the given element appended at the end.
        Specified by:
        append in interface IndexedSeq<java.lang.Character>
        Specified by:
        append in interface Seq<java.lang.Character>
        Parameters:
        element - the element to append
        Returns:
        a new Seq containing all elements of this sequence followed by the given element
      • appendAll

        public CharSeq appendAll​(@NonNull java.lang.Iterable<? extends java.lang.Character> elements)
        Description copied from interface: Seq
        Returns a new sequence with all elements from the given Iterable appended at the end of this sequence.
        Specified by:
        appendAll in interface IndexedSeq<java.lang.Character>
        Specified by:
        appendAll in interface Seq<java.lang.Character>
        Parameters:
        elements - the elements to append; must not be null
        Returns:
        a new Seq containing all elements of this sequence followed by the given elements
      • asJava

        @GwtIncompatible
        public java.util.List<java.lang.Character> asJava()
        Description copied from interface: Seq
        Returns an immutable List view of this Seq. Any attempt to modify the view (e.g., via mutator methods) will throw UnsupportedOperationException at runtime.

        This is a view, not a copy. Compared to conversion methods like toJava*():

        • Creating the view is O(1) (constant time), whereas conversions take O(n), with n = collection size.
        • Operations on the view have the same performance characteristics as the underlying persistent Vavr collection, while converted collections behave like standard Java collections.

        Note: the immutable Java list view throws UnsupportedOperationException before checking method arguments, which may differ from standard Java behavior.

        Specified by:
        asJava in interface Seq<java.lang.Character>
        Returns:
        an immutable List view of this sequence
      • asJava

        @GwtIncompatible
        public CharSeq asJava​(@NonNull java.util.function.Consumer<? super java.util.List<java.lang.Character>> action)
        Description copied from interface: Seq
        Creates an immutable List view of this Seq and passes it to the given action.

        The view is immutable: any attempt to modify it will throw UnsupportedOperationException at runtime.

        Specified by:
        asJava in interface IndexedSeq<java.lang.Character>
        Specified by:
        asJava in interface Seq<java.lang.Character>
        Parameters:
        action - a side-effecting operation that receives an immutable java.util.List view
        Returns:
        this sequence
        See Also:
        Seq.asJava()
      • asJavaMutable

        @GwtIncompatible
        public java.util.List<java.lang.Character> asJavaMutable()
        Description copied from interface: Seq
        Returns a mutable List view of this Seq. All standard mutator methods of the List interface are supported and modify the underlying view.

        Unlike Seq.asJava(), this view allows modifications, but the performance characteristics correspond to the underlying persistent Vavr collection.

        Specified by:
        asJavaMutable in interface Seq<java.lang.Character>
        Returns:
        a mutable List view of this sequence
        See Also:
        Seq.asJava()
      • asJavaMutable

        @GwtIncompatible
        public CharSeq asJavaMutable​(@NonNull java.util.function.Consumer<? super java.util.List<java.lang.Character>> action)
        Description copied from interface: Seq
        Creates a mutable List view of this Seq and passes it to the given action.

        The view supports all standard mutator methods. The result of the action determines what is returned:

        • If only read operations are performed, this instance is returned.
        • If any write operations are performed, a new Seq reflecting those changes is returned.
        Specified by:
        asJavaMutable in interface IndexedSeq<java.lang.Character>
        Specified by:
        asJavaMutable in interface Seq<java.lang.Character>
        Parameters:
        action - a side-effecting operation that receives a mutable java.util.List view
        Returns:
        this sequence or a new sequence reflecting modifications made through the view
        See Also:
        Seq.asJavaMutable()
      • collect

        public <R> IndexedSeq<R> collect​(@NonNull PartialFunction<? super java.lang.Character,​? extends R> partialFunction)
        Description copied from interface: Traversable
        Applies a PartialFunction to all elements that are defined for it and collects the results.

        For each element in iteration order, the function is first tested:

        
         partialFunction.isDefinedAt(element)
         
        If true, the element is mapped to type R:
        
         R newElement = partialFunction.apply(element)
         

        Note: If this Traversable is ordered (i.e., extends Ordered), the caller must ensure that the resulting elements are comparable (i.e., implement Comparable).

        Specified by:
        collect in interface IndexedSeq<java.lang.Character>
        Specified by:
        collect in interface Seq<java.lang.Character>
        Specified by:
        collect in interface Traversable<java.lang.Character>
        Type Parameters:
        R - the type of elements in the resulting Traversable
        Parameters:
        partialFunction - a function that may not be defined for all elements of this traversable
        Returns:
        a new Traversable containing the results of applying the partial function
      • combinations

        public IndexedSeq<CharSeq> combinations()
        Description copied from interface: Seq
        Returns a sequence containing all combinations of elements from this sequence, for all sizes from 0 to length().

        Examples:

         
         [].combinations() = [[]]
        
         [1,2,3].combinations() = [
           [],                  // k = 0
           [1], [2], [3],       // k = 1
           [1,2], [1,3], [2,3], // k = 2
           [1,2,3]              // k = 3
         ]
         
         
        Specified by:
        combinations in interface IndexedSeq<java.lang.Character>
        Specified by:
        combinations in interface Seq<java.lang.Character>
        Returns:
        a sequence of sequences representing all combinations of this sequence's elements
      • combinations

        public IndexedSeq<CharSeq> combinations​(int k)
        Description copied from interface: Seq
        Returns all subsets of this sequence containing exactly k distinct elements, i.e., the k-combinations of this sequence.
        Specified by:
        combinations in interface IndexedSeq<java.lang.Character>
        Specified by:
        combinations in interface Seq<java.lang.Character>
        Parameters:
        k - the size of each subset
        Returns:
        a sequence of sequences representing all k-element combinations
        See Also:
        Combination
      • crossProduct

        public Iterator<CharSeq> crossProduct​(int power)
        Description copied from interface: Seq
        Returns the n-ary Cartesian power (cross product) of this sequence. Each element of the resulting iterator is a sequence of length power, containing all possible combinations of elements from this sequence.

        Example for power = 2:

        
         // Result: [(A,A), (A,B), (A,C), ..., (B,A), (B,B), ..., (Z,Y), (Z,Z)]
         CharSeq.rangeClosed('A', 'Z').crossProduct(2);
         

        If power is negative, the result is an empty iterator:

        
         // Result: ()
         CharSeq.rangeClosed('A', 'Z').crossProduct(-1);
         
        Specified by:
        crossProduct in interface IndexedSeq<java.lang.Character>
        Specified by:
        crossProduct in interface Seq<java.lang.Character>
        Parameters:
        power - the number of Cartesian multiplications
        Returns:
        an Iterator over sequences representing the Cartesian power of this sequence
      • distinct

        public CharSeq distinct()
        Description copied from interface: Traversable
        Returns a new Traversable containing the elements of this instance with all duplicates removed. Element equality is determined using equals.
        Specified by:
        distinct in interface IndexedSeq<java.lang.Character>
        Specified by:
        distinct in interface Seq<java.lang.Character>
        Specified by:
        distinct in interface Traversable<java.lang.Character>
        Returns:
        a new Traversable without duplicate elements
      • distinctBy

        public CharSeq distinctBy​(@NonNull java.util.Comparator<? super java.lang.Character> comparator)
        Description copied from interface: Traversable
        Returns a new Traversable containing the elements of this instance without duplicates, as determined by the given comparator.
        Specified by:
        distinctBy in interface IndexedSeq<java.lang.Character>
        Specified by:
        distinctBy in interface Seq<java.lang.Character>
        Specified by:
        distinctBy in interface Traversable<java.lang.Character>
        Parameters:
        comparator - a comparator used to determine equality of elements
        Returns:
        a new Traversable with duplicates removed
      • distinctBy

        public <U> CharSeq distinctBy​(@NonNull java.util.function.Function<? super java.lang.Character,​? extends U> keyExtractor)
        Description copied from interface: Traversable
        Returns a new Traversable containing the elements of this instance without duplicates, based on keys extracted from elements using keyExtractor.

        The first occurrence of each key is retained in the resulting sequence.

        Specified by:
        distinctBy in interface IndexedSeq<java.lang.Character>
        Specified by:
        distinctBy in interface Seq<java.lang.Character>
        Specified by:
        distinctBy in interface Traversable<java.lang.Character>
        Type Parameters:
        U - the type of key
        Parameters:
        keyExtractor - a function to extract keys for determining uniqueness
        Returns:
        a new Traversable with duplicates removed based on keys
      • distinctByKeepLast

        public CharSeq distinctByKeepLast​(@NonNull java.util.Comparator<? super java.lang.Character> comparator)
        Description copied from interface: Seq
        Returns a sequence with duplicate elements removed, as determined by the provided comparator. When duplicates are found, the **last occurrence** of each element is retained.
        Specified by:
        distinctByKeepLast in interface IndexedSeq<java.lang.Character>
        Specified by:
        distinctByKeepLast in interface Seq<java.lang.Character>
        Parameters:
        comparator - a comparator defining equality between elements
        Returns:
        a new sequence with duplicates removed, keeping the last occurrence of each element
      • distinctByKeepLast

        public <U> CharSeq distinctByKeepLast​(@NonNull java.util.function.Function<? super java.lang.Character,​? extends U> keyExtractor)
        Description copied from interface: Seq
        Returns a sequence with duplicates removed based on a key extracted from each element. The key is obtained via the provided keyExtractor function. When duplicates are found, the **last occurrence** of each element for a given key is retained.
        Specified by:
        distinctByKeepLast in interface IndexedSeq<java.lang.Character>
        Specified by:
        distinctByKeepLast in interface Seq<java.lang.Character>
        Type Parameters:
        U - the type of the key used for determining uniqueness
        Parameters:
        keyExtractor - a function extracting a key from each element for uniqueness comparison
        Returns:
        a new sequence of elements distinct by the extracted key, keeping the last occurrence
      • drop

        public CharSeq drop​(int n)
        Description copied from interface: Traversable
        Returns a new Traversable without the first n elements, or an empty instance if this contains fewer than n elements.
        Specified by:
        drop in interface IndexedSeq<java.lang.Character>
        Specified by:
        drop in interface Seq<java.lang.Character>
        Specified by:
        drop in interface Traversable<java.lang.Character>
        Parameters:
        n - the number of elements to drop
        Returns:
        a new instance excluding the first n elements
      • dropUntil

        public CharSeq dropUntil​(@NonNull java.util.function.Predicate<? super java.lang.Character> predicate)
        Description copied from interface: Traversable
        Returns a new Traversable starting from the first element that satisfies the given predicate, dropping all preceding elements.
        Specified by:
        dropUntil in interface IndexedSeq<java.lang.Character>
        Specified by:
        dropUntil in interface Seq<java.lang.Character>
        Specified by:
        dropUntil in interface Traversable<java.lang.Character>
        Parameters:
        predicate - a condition tested on each element
        Returns:
        a new instance starting from the first element matching the predicate
      • dropWhile

        public CharSeq dropWhile​(@NonNull java.util.function.Predicate<? super java.lang.Character> predicate)
        Description copied from interface: Traversable
        Returns a new Traversable starting from the first element that does not satisfy the given predicate, dropping all preceding elements.

        This is equivalent to dropUntil(predicate.negate()), which is useful for method references that cannot be negated directly.

        Specified by:
        dropWhile in interface IndexedSeq<java.lang.Character>
        Specified by:
        dropWhile in interface Seq<java.lang.Character>
        Specified by:
        dropWhile in interface Traversable<java.lang.Character>
        Parameters:
        predicate - a condition tested on each element
        Returns:
        a new instance starting from the first element not matching the predicate
      • dropRight

        public CharSeq dropRight​(int n)
        Description copied from interface: Traversable
        Returns a new Traversable without the last n elements, or an empty instance if this contains fewer than n elements.
        Specified by:
        dropRight in interface IndexedSeq<java.lang.Character>
        Specified by:
        dropRight in interface Seq<java.lang.Character>
        Specified by:
        dropRight in interface Traversable<java.lang.Character>
        Parameters:
        n - the number of elements to drop from the end
        Returns:
        a new instance excluding the last n elements
      • dropRightWhile

        public CharSeq dropRightWhile​(@NonNull java.util.function.Predicate<? super java.lang.Character> predicate)
        Description copied from interface: Seq
        Drops elements from the end of the sequence while the given predicate holds.

        This is equivalent to dropRightUntil(predicate.negate()). Useful when using method references that cannot be negated directly.

        Specified by:
        dropRightWhile in interface IndexedSeq<java.lang.Character>
        Specified by:
        dropRightWhile in interface Seq<java.lang.Character>
        Parameters:
        predicate - a condition to test elements, starting from the end
        Returns:
        a new sequence containing all elements up to and including the last element that does not satisfy the predicate
      • dropRightUntil

        public CharSeq dropRightUntil​(@NonNull java.util.function.Predicate<? super java.lang.Character> predicate)
        Description copied from interface: Seq
        Drops elements from the end of the sequence until an element satisfies the given predicate. The returned sequence includes the last element that satisfies the predicate.
        Specified by:
        dropRightUntil in interface IndexedSeq<java.lang.Character>
        Specified by:
        dropRightUntil in interface Seq<java.lang.Character>
        Parameters:
        predicate - a condition to test elements, starting from the end
        Returns:
        a new sequence containing all elements up to and including the last element that satisfies the predicate
      • filter

        public CharSeq filter​(@NonNull java.util.function.Predicate<? super java.lang.Character> predicate)
        Description copied from interface: Traversable
        Returns a new traversable containing only the elements that satisfy the given predicate.
        Specified by:
        filter in interface IndexedSeq<java.lang.Character>
        Specified by:
        filter in interface Seq<java.lang.Character>
        Specified by:
        filter in interface Traversable<java.lang.Character>
        Parameters:
        predicate - the condition to test elements
        Returns:
        a traversable with elements matching the predicate
      • reject

        public CharSeq reject​(@NonNull java.util.function.Predicate<? super java.lang.Character> predicate)
        Description copied from interface: Traversable
        Returns a new traversable containing only the elements that do not satisfy the given predicate.

        This is equivalent to filter(predicate.negate()).

        Specified by:
        reject in interface IndexedSeq<java.lang.Character>
        Specified by:
        reject in interface Seq<java.lang.Character>
        Specified by:
        reject in interface Traversable<java.lang.Character>
        Parameters:
        predicate - the condition to test elements
        Returns:
        a traversable with elements not matching the predicate
      • flatMap

        public <U> IndexedSeq<U> flatMap​(@NonNull java.util.function.Function<? super java.lang.Character,​? extends java.lang.Iterable<? extends U>> mapper)
        Description copied from interface: Traversable
        Transforms each element of this Traversable into an Iterable of elements and flattens the resulting iterables into a single Traversable.
        Specified by:
        flatMap in interface IndexedSeq<java.lang.Character>
        Specified by:
        flatMap in interface Seq<java.lang.Character>
        Specified by:
        flatMap in interface Traversable<java.lang.Character>
        Type Parameters:
        U - the type of elements in the resulting Traversable
        Parameters:
        mapper - a function mapping elements to iterables
        Returns:
        a new Traversable containing all elements produced by applying mapper and flattening
      • flatMapChars

        public CharSeq flatMapChars​(@NonNull CharSeq.CharFunction<? extends java.lang.CharSequence> mapper)
        FlatMaps this CharSeq to a new CharSeq by applying a CharFunction to each character, which returns a CharSequence, and concatenating the results.

        This is a specialized version of flatMap(Function) for primitive characters that returns a CharSeq instead of an IndexedSeq<Character>.

        Parameters:
        mapper - A mapper that takes a char and returns a CharSequence
        Returns:
        A new CharSeq containing the concatenated results
        Throws:
        java.lang.NullPointerException - if mapper is null
      • groupBy

        public <C> Map<C,​CharSeq> groupBy​(@NonNull java.util.function.Function<? super java.lang.Character,​? extends C> classifier)
        Description copied from interface: Traversable
        Groups elements of this Traversable based on a classifier function.
        Specified by:
        groupBy in interface IndexedSeq<java.lang.Character>
        Specified by:
        groupBy in interface Seq<java.lang.Character>
        Specified by:
        groupBy in interface Traversable<java.lang.Character>
        Type Parameters:
        C - The type of the group keys
        Parameters:
        classifier - A function that assigns each element to a group
        Returns:
        A map where each key corresponds to a group of elements
        See Also:
        Traversable.arrangeBy(Function)
      • grouped

        public Iterator<CharSeq> grouped​(int size)
        Description copied from interface: Traversable
        Splits this Traversable into consecutive blocks of the given size.

        Let length be the number of elements in this Traversable:

        • If empty, the resulting Iterator is empty.
        • If size <= length, the resulting Iterator contains length / size blocks of size size and possibly a final smaller block of size length % size.
        • If size > length, the resulting Iterator contains a single block of size length.

        Examples:

         
         [].grouped(1) = []
         [].grouped(0) throws
         [].grouped(-1) throws
         [1,2,3,4].grouped(2) = [[1,2],[3,4]]
         [1,2,3,4,5].grouped(2) = [[1,2],[3,4],[5]]
         [1,2,3,4].grouped(5) = [[1,2,3,4]]
         
         

        Note: grouped(size) is equivalent to sliding(size, size).

        Specified by:
        grouped in interface IndexedSeq<java.lang.Character>
        Specified by:
        grouped in interface Seq<java.lang.Character>
        Specified by:
        grouped in interface Traversable<java.lang.Character>
        Parameters:
        size - the block size; must be positive
        Returns:
        an Iterator over blocks of elements
      • hasDefiniteSize

        public boolean hasDefiniteSize()
        Description copied from interface: Traversable
        Indicates whether this Traversable has a known finite size.

        This should typically be implemented by concrete classes, not interfaces.

        Specified by:
        hasDefiniteSize in interface Traversable<java.lang.Character>
        Returns:
        true if the number of elements is finite and known, false otherwise.
      • init

        public CharSeq init()
        Description copied from interface: Traversable
        Returns all elements of this Traversable except the last one.

        This is the dual of Traversable.tail().

        Specified by:
        init in interface IndexedSeq<java.lang.Character>
        Specified by:
        init in interface Seq<java.lang.Character>
        Specified by:
        init in interface Traversable<java.lang.Character>
        Returns:
        a new instance containing all elements except the last
      • initOption

        public Option<CharSeq> initOption()
        Description copied from interface: Traversable
        Returns all elements of this Traversable except the last one, wrapped in an Option.

        This is the dual of Traversable.tailOption().

        Specified by:
        initOption in interface IndexedSeq<java.lang.Character>
        Specified by:
        initOption in interface Seq<java.lang.Character>
        Specified by:
        initOption in interface Traversable<java.lang.Character>
        Returns:
        Some(traversable) if non-empty, or None if this Traversable is empty
      • insert

        public CharSeq insert​(int index,
                              java.lang.Character element)
        Description copied from interface: Seq
        Returns a new sequence with the given element inserted at the specified index.
        Specified by:
        insert in interface IndexedSeq<java.lang.Character>
        Specified by:
        insert in interface Seq<java.lang.Character>
        Parameters:
        index - the position at which to insert the element
        element - the element to insert
        Returns:
        a new Seq with the element inserted
      • insertAll

        public CharSeq insertAll​(int index,
                                 @NonNull java.lang.Iterable<? extends java.lang.Character> elements)
        Description copied from interface: Seq
        Returns a new sequence with the given elements inserted at the specified index.
        Specified by:
        insertAll in interface IndexedSeq<java.lang.Character>
        Specified by:
        insertAll in interface Seq<java.lang.Character>
        Parameters:
        index - the position at which to insert the elements
        elements - the elements to insert; must not be null
        Returns:
        a new Seq with the elements inserted
      • iterator

        public @NonNull Iterator<java.lang.Character> iterator()
        Description copied from interface: Traversable
        Returns an iterator over the elements of this Traversable, implemented via Traversable.head() and Traversable.tail(). Subclasses may override for a more efficient implementation.
        Specified by:
        iterator in interface java.lang.Iterable<java.lang.Character>
        Specified by:
        iterator in interface Traversable<java.lang.Character>
        Specified by:
        iterator in interface Value<java.lang.Character>
        Returns:
        a new Iterator over the elements of this Traversable
      • intersperse

        public CharSeq intersperse​(java.lang.Character element)
        Description copied from interface: Seq
        Returns a new sequence where the given element is inserted between all elements of this sequence.
        Specified by:
        intersperse in interface IndexedSeq<java.lang.Character>
        Specified by:
        intersperse in interface Seq<java.lang.Character>
        Parameters:
        element - the element to intersperse
        Returns:
        a new Seq with the element interspersed
      • map

        public <U> IndexedSeq<U> map​(@NonNull java.util.function.Function<? super java.lang.Character,​? extends U> mapper)
        Description copied from interface: Traversable
        Transforms the elements of this Traversable to a new type, preserving order if defined.
        Specified by:
        map in interface IndexedSeq<java.lang.Character>
        Specified by:
        map in interface Seq<java.lang.Character>
        Specified by:
        map in interface Traversable<java.lang.Character>
        Specified by:
        map in interface Value<java.lang.Character>
        Type Parameters:
        U - the target element type
        Parameters:
        mapper - a mapping function
        Returns:
        a new Traversable containing the mapped elements
      • mapTo

        public <U> IndexedSeq<U> mapTo​(U value)
        Description copied from interface: Value
        Maps the underlying value to another fixed value.
        Specified by:
        mapTo in interface IndexedSeq<java.lang.Character>
        Specified by:
        mapTo in interface Seq<java.lang.Character>
        Specified by:
        mapTo in interface Traversable<java.lang.Character>
        Specified by:
        mapTo in interface Value<java.lang.Character>
        Type Parameters:
        U - The new component type
        Parameters:
        value - value to replace the contents with
        Returns:
        A new value
      • mapToVoid

        public IndexedSeq<java.lang.Void> mapToVoid()
        Description copied from interface: Value
        Maps the underlying value to Void
        Specified by:
        mapToVoid in interface IndexedSeq<java.lang.Character>
        Specified by:
        mapToVoid in interface Seq<java.lang.Character>
        Specified by:
        mapToVoid in interface Traversable<java.lang.Character>
        Specified by:
        mapToVoid in interface Value<java.lang.Character>
        Returns:
        A new value of type Void
      • mkString

        public java.lang.String mkString()
        Description copied from interface: Traversable
        Concatenates the string representations of all elements in this Traversable.

        Equivalent to mkString("", "", "").

        Specified by:
        mkString in interface Traversable<java.lang.Character>
        Returns:
        a new String containing all elements concatenated
      • padTo

        public CharSeq padTo​(int length,
                             java.lang.Character element)
        Description copied from interface: Seq
        Returns a new sequence with this sequence padded on the right with the given element until the specified target length is reached.

        Note: Lazily-evaluated sequences may need to process all elements to determine the overall length.

        Specified by:
        padTo in interface IndexedSeq<java.lang.Character>
        Specified by:
        padTo in interface Seq<java.lang.Character>
        Parameters:
        length - the target length of the resulting sequence
        element - the element to append as padding
        Returns:
        a new Seq consisting of this sequence followed by the minimal number of occurrences of element to reach at least length
      • leftPadTo

        public CharSeq leftPadTo​(int length,
                                 java.lang.Character element)
        Description copied from interface: Seq
        Returns a new sequence with this sequence padded on the left with the given element until the specified target length is reached.

        Note: Lazily-evaluated sequences may need to process all elements to determine the overall length.

        Specified by:
        leftPadTo in interface Seq<java.lang.Character>
        Parameters:
        length - the target length of the resulting sequence
        element - the element to prepend as padding
        Returns:
        a new Seq consisting of this sequence prepended by the minimal number of occurrences of element to reach at least length
      • orElse

        public CharSeq orElse​(java.lang.Iterable<? extends java.lang.Character> other)
        Description copied from interface: Traversable
        Returns this Traversable if it is non-empty; otherwise, returns the given alternative.
        Specified by:
        orElse in interface IndexedSeq<java.lang.Character>
        Specified by:
        orElse in interface Seq<java.lang.Character>
        Specified by:
        orElse in interface Traversable<java.lang.Character>
        Parameters:
        other - an alternative Traversable to return if this is empty
        Returns:
        this Traversable if non-empty, otherwise other
      • orElse

        public CharSeq orElse​(@NonNull java.util.function.Supplier<? extends java.lang.Iterable<? extends java.lang.Character>> supplier)
        Description copied from interface: Traversable
        Returns this Traversable if it is non-empty; otherwise, returns the result of evaluating the given supplier.
        Specified by:
        orElse in interface IndexedSeq<java.lang.Character>
        Specified by:
        orElse in interface Seq<java.lang.Character>
        Specified by:
        orElse in interface Traversable<java.lang.Character>
        Parameters:
        supplier - a supplier of an alternative Traversable if this is empty
        Returns:
        this Traversable if non-empty, otherwise the result of supplier.get()
      • padding

        private static java.lang.StringBuilder padding​(char element,
                                                       int limit)
      • patch

        public CharSeq patch​(int from,
                             @NonNull java.lang.Iterable<? extends java.lang.Character> that,
                             int replaced)
        Description copied from interface: Seq
        Returns a new sequence in which a slice of elements in this sequence is replaced by the elements of another sequence.
        Specified by:
        patch in interface IndexedSeq<java.lang.Character>
        Specified by:
        patch in interface Seq<java.lang.Character>
        Parameters:
        from - the starting index of the slice to be replaced
        that - the sequence of elements to insert; must not be null
        replaced - the number of elements to remove from this sequence starting at from
        Returns:
        a new Seq with the specified slice replaced
      • mapChars

        public CharSeq mapChars​(CharSeq.CharUnaryOperator mapper)
        Maps this CharSeq to a new CharSeq by applying a CharUnaryOperator to each character.

        This is a specialized version of map(Function) for primitive characters that returns a CharSeq instead of an IndexedSeq<Character>.

        Parameters:
        mapper - A mapper that takes a char and returns a char
        Returns:
        A new CharSeq containing the mapped characters
        Throws:
        java.lang.NullPointerException - if mapper is null
      • partition

        public Tuple2<CharSeq,​CharSeq> partition​(@NonNull java.util.function.Predicate<? super java.lang.Character> predicate)
        Description copied from interface: Traversable
        Splits this Traversable into two partitions according to a predicate.

        The first partition contains all elements that satisfy the predicate, and the second contains all elements that do not. The original iteration order is preserved.

        Specified by:
        partition in interface IndexedSeq<java.lang.Character>
        Specified by:
        partition in interface Seq<java.lang.Character>
        Specified by:
        partition in interface Traversable<java.lang.Character>
        Parameters:
        predicate - a predicate used to classify elements
        Returns:
        a Tuple2 containing the two resulting Traversable instances
      • peek

        public CharSeq peek​(@NonNull java.util.function.Consumer<? super java.lang.Character> action)
        Description copied from interface: Value
        Performs the given action on the first element if this is an eager implementation. Performs the given action on all elements (the first immediately, successive deferred), if this is a lazy implementation.
        Specified by:
        peek in interface IndexedSeq<java.lang.Character>
        Specified by:
        peek in interface Seq<java.lang.Character>
        Specified by:
        peek in interface Traversable<java.lang.Character>
        Specified by:
        peek in interface Value<java.lang.Character>
        Parameters:
        action - The action that will be performed on the element(s).
        Returns:
        this instance
      • permutations

        public IndexedSeq<CharSeq> permutations()
        Description copied from interface: Seq
        Returns all unique permutations of this sequence.

        Example:

        
         [].permutations() = []
        
         [1, 2, 3].permutations() = [
           [1, 2, 3],
           [1, 3, 2],
           [2, 1, 3],
           [2, 3, 1],
           [3, 1, 2],
           [3, 2, 1]
         ]
         
        Specified by:
        permutations in interface IndexedSeq<java.lang.Character>
        Specified by:
        permutations in interface Seq<java.lang.Character>
        Returns:
        a sequence of all unique permutations of this sequence
      • prepend

        public CharSeq prepend​(java.lang.Character element)
        Description copied from interface: Seq
        Returns a new sequence with the given element prepended to this sequence.
        Specified by:
        prepend in interface IndexedSeq<java.lang.Character>
        Specified by:
        prepend in interface Seq<java.lang.Character>
        Parameters:
        element - the element to prepend
        Returns:
        a new Seq with the element added at the front
      • prependAll

        public CharSeq prependAll​(@NonNull java.lang.Iterable<? extends java.lang.Character> elements)
        Description copied from interface: Seq
        Returns a new sequence with all given elements prepended to this sequence.
        Specified by:
        prependAll in interface IndexedSeq<java.lang.Character>
        Specified by:
        prependAll in interface Seq<java.lang.Character>
        Parameters:
        elements - the elements to prepend; must not be null
        Returns:
        a new Seq with the elements added at the front
      • remove

        public CharSeq remove​(java.lang.Character element)
        Description copied from interface: Seq
        Returns a new sequence with the first occurrence of the given element removed.
        Specified by:
        remove in interface IndexedSeq<java.lang.Character>
        Specified by:
        remove in interface Seq<java.lang.Character>
        Parameters:
        element - the element to remove
        Returns:
        a new Seq without the first occurrence of the element
      • removeFirst

        public CharSeq removeFirst​(@NonNull java.util.function.Predicate<java.lang.Character> predicate)
        Description copied from interface: Seq
        Returns a new sequence with the first element that satisfies the given predicate removed.
        Specified by:
        removeFirst in interface IndexedSeq<java.lang.Character>
        Specified by:
        removeFirst in interface Seq<java.lang.Character>
        Parameters:
        predicate - the predicate used to identify the element to remove; must not be null
        Returns:
        a new Seq without the first matching element
      • removeLast

        public CharSeq removeLast​(@NonNull java.util.function.Predicate<java.lang.Character> predicate)
        Description copied from interface: Seq
        Returns a new sequence with the last element that satisfies the given predicate removed.
        Specified by:
        removeLast in interface IndexedSeq<java.lang.Character>
        Specified by:
        removeLast in interface Seq<java.lang.Character>
        Parameters:
        predicate - the predicate used to identify the element to remove; must not be null
        Returns:
        a new Seq without the last matching element
      • removeAt

        public CharSeq removeAt​(int index)
        Description copied from interface: Seq
        Returns a new sequence with the element at the specified position removed. Subsequent elements are shifted to the left (indices decreased by one).
        Specified by:
        removeAt in interface IndexedSeq<java.lang.Character>
        Specified by:
        removeAt in interface Seq<java.lang.Character>
        Parameters:
        index - the position of the element to remove
        Returns:
        a new Seq without the element at the specified index
      • removeAll

        public CharSeq removeAll​(java.lang.Character element)
        Description copied from interface: Seq
        Returns a new sequence with all occurrences of the given element removed.
        Specified by:
        removeAll in interface IndexedSeq<java.lang.Character>
        Specified by:
        removeAll in interface Seq<java.lang.Character>
        Parameters:
        element - the element to remove
        Returns:
        a new Seq without any occurrences of the element
      • removeAll

        public CharSeq removeAll​(@NonNull java.lang.Iterable<? extends java.lang.Character> elements)
        Description copied from interface: Seq
        Returns a new sequence with all occurrences of the given elements removed.
        Specified by:
        removeAll in interface IndexedSeq<java.lang.Character>
        Specified by:
        removeAll in interface Seq<java.lang.Character>
        Parameters:
        elements - the elements to remove; must not be null
        Returns:
        a new Seq without any of the given elements
      • removeAll

        @Deprecated
        public CharSeq removeAll​(@NonNull java.util.function.Predicate<? super java.lang.Character> predicate)
        Deprecated.
        Description copied from interface: Seq
        Returns a new Seq consisting of all elements which do not satisfy the given predicate.
        Specified by:
        removeAll in interface IndexedSeq<java.lang.Character>
        Specified by:
        removeAll in interface Seq<java.lang.Character>
        Parameters:
        predicate - the predicate used to test elements
        Returns:
        a new Seq
      • replace

        public CharSeq replace​(java.lang.Character currentElement,
                               java.lang.Character newElement)
        Description copied from interface: Traversable
        Replaces the first occurrence of currentElement with newElement, if it exists.
        Specified by:
        replace in interface IndexedSeq<java.lang.Character>
        Specified by:
        replace in interface Seq<java.lang.Character>
        Specified by:
        replace in interface Traversable<java.lang.Character>
        Parameters:
        currentElement - the element to be replaced
        newElement - the replacement element
        Returns:
        a new Traversable with the first occurrence of currentElement replaced by newElement
      • replaceAll

        public CharSeq replaceAll​(java.lang.Character currentElement,
                                  java.lang.Character newElement)
        Description copied from interface: Traversable
        Replaces all occurrences of currentElement with newElement.
        Specified by:
        replaceAll in interface IndexedSeq<java.lang.Character>
        Specified by:
        replaceAll in interface Seq<java.lang.Character>
        Specified by:
        replaceAll in interface Traversable<java.lang.Character>
        Parameters:
        currentElement - the element to be replaced
        newElement - the replacement element
        Returns:
        a new Traversable with all occurrences of currentElement replaced by newElement
      • retainAll

        public CharSeq retainAll​(@NonNull java.lang.Iterable<? extends java.lang.Character> elements)
        Description copied from interface: Traversable
        Retains only the elements from this Traversable that are contained in the given elements.
        Specified by:
        retainAll in interface IndexedSeq<java.lang.Character>
        Specified by:
        retainAll in interface Seq<java.lang.Character>
        Specified by:
        retainAll in interface Traversable<java.lang.Character>
        Parameters:
        elements - the elements to keep
        Returns:
        a new Traversable containing only the elements present in elements, in their original order
      • reverse

        public CharSeq reverse()
        Description copied from interface: Seq
        Returns a new sequence with the order of elements reversed.
        Specified by:
        reverse in interface IndexedSeq<java.lang.Character>
        Specified by:
        reverse in interface Seq<java.lang.Character>
        Returns:
        a new Seq with elements in reversed order
      • rotateLeft

        public CharSeq rotateLeft​(int n)
        Description copied from interface: Seq
        Returns a new sequence with the elements circularly rotated to the left by the specified distance.

        Example:

        
         // Result: List(3, 4, 5, 1, 2)
         List.of(1, 2, 3, 4, 5).rotateLeft(2);
         
        Specified by:
        rotateLeft in interface IndexedSeq<java.lang.Character>
        Specified by:
        rotateLeft in interface Seq<java.lang.Character>
        Parameters:
        n - the number of positions to rotate left
        Returns:
        a new Seq with elements rotated left
      • rotateRight

        public CharSeq rotateRight​(int n)
        Description copied from interface: Seq
        Returns a new sequence with the elements circularly rotated to the right by the specified distance.

        Example:

        
         // Result: List(4, 5, 1, 2, 3)
         List.of(1, 2, 3, 4, 5).rotateRight(2);
         
        Specified by:
        rotateRight in interface IndexedSeq<java.lang.Character>
        Specified by:
        rotateRight in interface Seq<java.lang.Character>
        Parameters:
        n - the number of positions to rotate right
        Returns:
        a new Seq with elements rotated right
      • scan

        public CharSeq scan​(java.lang.Character zero,
                            @NonNull java.util.function.BiFunction<? super java.lang.Character,​? super java.lang.Character,​? extends java.lang.Character> operation)
        Description copied from interface: Traversable
        Computes a prefix scan of the elements of this Traversable.

        The neutral element zero may be applied more than once.

        Specified by:
        scan in interface IndexedSeq<java.lang.Character>
        Specified by:
        scan in interface Seq<java.lang.Character>
        Specified by:
        scan in interface Traversable<java.lang.Character>
        Parameters:
        zero - the neutral element for the operator
        operation - an associative binary operator
        Returns:
        a new Traversable containing the prefix scan of the elements
      • scanLeft

        public <U> IndexedSeq<U> scanLeft​(U zero,
                                          @NonNull java.util.function.BiFunction<? super U,​? super java.lang.Character,​? extends U> operation)
        Description copied from interface: Traversable
        Produces a collection containing cumulative results of applying the operator from left to right.

        Will not terminate for infinite collections. The results may vary across runs unless the collection is ordered.

        Specified by:
        scanLeft in interface IndexedSeq<java.lang.Character>
        Specified by:
        scanLeft in interface Seq<java.lang.Character>
        Specified by:
        scanLeft in interface Traversable<java.lang.Character>
        Type Parameters:
        U - the type of the resulting elements
        Parameters:
        zero - the initial value
        operation - a binary operator applied to the intermediate result and each element
        Returns:
        a new Traversable containing the cumulative results
      • scanRight

        public <U> IndexedSeq<U> scanRight​(U zero,
                                           @NonNull java.util.function.BiFunction<? super java.lang.Character,​? super U,​? extends U> operation)
        Description copied from interface: Traversable
        Produces a collection containing cumulative results of applying the operator from right to left.

        The head of the resulting collection is the last cumulative result. Will not terminate for infinite collections. Results may vary across runs unless the collection is ordered.

        Specified by:
        scanRight in interface IndexedSeq<java.lang.Character>
        Specified by:
        scanRight in interface Seq<java.lang.Character>
        Specified by:
        scanRight in interface Traversable<java.lang.Character>
        Type Parameters:
        U - the type of the resulting elements
        Parameters:
        zero - the initial value
        operation - a binary operator applied to each element and the intermediate result
        Returns:
        a new Traversable containing the cumulative results
      • shuffle

        public CharSeq shuffle()
        Description copied from interface: Seq
        Returns a new sequence with the elements randomly shuffled.
        Specified by:
        shuffle in interface IndexedSeq<java.lang.Character>
        Specified by:
        shuffle in interface Seq<java.lang.Character>
        Returns:
        a new Seq containing the same elements in a random order
      • slice

        public CharSeq slice​(int beginIndex,
                             int endIndex)
        Description copied from interface: Seq
        Returns a subsequence (slice) of this sequence, starting at beginIndex (inclusive) and ending at endIndex (exclusive).

        Examples:

        
         List.of(1, 2, 3, 4).slice(1, 3); // = (2, 3)
         List.of(1, 2, 3, 4).slice(0, 4); // = (1, 2, 3, 4)
         List.of(1, 2, 3, 4).slice(2, 2); // = ()
         List.of(1, 2).slice(1, 0);       // = ()
         List.of(1, 2).slice(-10, 10);    // = (1, 2)
         

        See also Seq.subSequence(int, int), which may throw an exception instead of returning a sequence in some cases.

        Specified by:
        slice in interface IndexedSeq<java.lang.Character>
        Specified by:
        slice in interface Seq<java.lang.Character>
        Parameters:
        beginIndex - the starting index (inclusive)
        endIndex - the ending index (exclusive)
        Returns:
        a new Seq representing the specified slice
      • slideBy

        public Iterator<CharSeq> slideBy​(@NonNull java.util.function.Function<? super java.lang.Character,​?> classifier)
        Description copied from interface: Traversable
        Partitions this Traversable into consecutive non-overlapping windows according to a classification function.

        Each window contains elements with the same class, as determined by classifier. Two consecutive elements belong to the same window only if classifier returns equal values for both. Otherwise, the current window ends and a new window begins with the next element.

        Examples:

        
         [].slideBy(Function.identity()) = []
         [1,2,3,4,4,5].slideBy(Function.identity()) = [[1],[2],[3],[4,4],[5]]
         [1,2,3,10,12,5,7,20,29].slideBy(x -> x / 10) = [[1,2,3],[10,12],[5,7],[20,29]]
         
        Specified by:
        slideBy in interface IndexedSeq<java.lang.Character>
        Specified by:
        slideBy in interface Seq<java.lang.Character>
        Specified by:
        slideBy in interface Traversable<java.lang.Character>
        Parameters:
        classifier - A function classifying elements into groups
        Returns:
        An Iterator of windows (grouped elements)
      • sliding

        public Iterator<CharSeq> sliding​(int size)
        Description copied from interface: Traversable
        Slides a window of a given size over this Traversable with a step size of 1.

        This is equivalent to calling Traversable.sliding(int, int) with a step size of 1.

        Specified by:
        sliding in interface IndexedSeq<java.lang.Character>
        Specified by:
        sliding in interface Seq<java.lang.Character>
        Specified by:
        sliding in interface Traversable<java.lang.Character>
        Parameters:
        size - a positive window size
        Returns:
        An Iterator of windows, each containing up to size elements
      • sliding

        public Iterator<CharSeq> sliding​(int size,
                                         int step)
        Description copied from interface: Traversable
        Slides a window of a specific size with a given step over this Traversable.

        Examples:

        
         [].sliding(1, 1) = []
         [1,2,3,4,5].sliding(2, 3) = [[1,2],[4,5]]
         [1,2,3,4,5].sliding(2, 4) = [[1,2],[5]]
         [1,2,3,4,5].sliding(2, 5) = [[1,2]]
         [1,2,3,4].sliding(5, 3) = [[1,2,3,4],[4]]
         
        Specified by:
        sliding in interface IndexedSeq<java.lang.Character>
        Specified by:
        sliding in interface Seq<java.lang.Character>
        Specified by:
        sliding in interface Traversable<java.lang.Character>
        Parameters:
        size - a positive window size
        step - a positive step size
        Returns:
        an Iterator of windows with the given size and step
      • sorted

        public CharSeq sorted()
        Description copied from interface: Seq
        Returns a new sequence with elements sorted according to their natural order.
        Specified by:
        sorted in interface IndexedSeq<java.lang.Character>
        Specified by:
        sorted in interface Seq<java.lang.Character>
        Returns:
        a new Seq with elements in natural order
      • sorted

        public CharSeq sorted​(@NonNull java.util.Comparator<? super java.lang.Character> comparator)
        Description copied from interface: Seq
        Returns a new sequence with elements sorted according to the given Comparator.
        Specified by:
        sorted in interface IndexedSeq<java.lang.Character>
        Specified by:
        sorted in interface Seq<java.lang.Character>
        Parameters:
        comparator - the comparator used to order elements; must not be null
        Returns:
        a new Seq with elements sorted according to the comparator
      • sortBy

        public <U extends java.lang.Comparable<? super U>> CharSeq sortBy​(@NonNull java.util.function.Function<? super java.lang.Character,​? extends U> mapper)
        Description copied from interface: Seq
        Returns a new sequence sorted by comparing elements in a different domain defined by the given mapper.
        Specified by:
        sortBy in interface IndexedSeq<java.lang.Character>
        Specified by:
        sortBy in interface Seq<java.lang.Character>
        Type Parameters:
        U - the type used for comparison
        Parameters:
        mapper - a function mapping elements to a Comparable domain; must not be null
        Returns:
        a new Seq sorted according to the mapped values
      • sortBy

        public <U> CharSeq sortBy​(@NonNull java.util.Comparator<? super U> comparator,
                                  java.util.function.Function<? super java.lang.Character,​? extends U> mapper)
        Description copied from interface: Seq
        Returns a new sequence sorted by comparing elements in a different domain defined by the given mapper, using the provided comparator.
        Specified by:
        sortBy in interface IndexedSeq<java.lang.Character>
        Specified by:
        sortBy in interface Seq<java.lang.Character>
        Type Parameters:
        U - the type used for comparison
        Parameters:
        comparator - the comparator used to compare mapped values; must not be null
        mapper - a function mapping elements to the domain for comparison; must not be null
        Returns:
        a new Seq sorted according to the mapped values and comparator
      • span

        public Tuple2<CharSeq,​CharSeq> span​(@NonNull java.util.function.Predicate<? super java.lang.Character> predicate)
        Description copied from interface: Traversable
        Splits this Traversable into a prefix and remainder according to the given predicate.

        The first element of the returned Tuple is the longest prefix of elements satisfying predicate, and the second element is the remaining elements.

        Specified by:
        span in interface IndexedSeq<java.lang.Character>
        Specified by:
        span in interface Seq<java.lang.Character>
        Specified by:
        span in interface Traversable<java.lang.Character>
        Parameters:
        predicate - a predicate used to determine the prefix
        Returns:
        a Tuple containing the prefix and remainder
      • subSequence

        public CharSeq subSequence​(int beginIndex)
        Description copied from interface: Seq
        Returns a Seq that is a subsequence of this sequence, starting from the specified beginIndex and extending to the end of this sequence.

        Examples:

        
         List.of(1, 2).subSequence(0);   // = (1, 2)
         List.of(1, 2).subSequence(1);   // = (2)
         List.of(1, 2).subSequence(2);   // = ()
         List.of(1, 2).subSequence(10);  // throws IndexOutOfBoundsException
         List.of(1, 2).subSequence(-10); // throws IndexOutOfBoundsException
         

        See also Seq.drop(int), which provides similar functionality but does not throw an exception for out-of-bounds indices.

        Specified by:
        subSequence in interface IndexedSeq<java.lang.Character>
        Specified by:
        subSequence in interface Seq<java.lang.Character>
        Parameters:
        beginIndex - the starting index (inclusive) of the subsequence
        Returns:
        a new Seq representing the subsequence from beginIndex to the end
      • tail

        public CharSeq tail()
        Description copied from interface: Traversable
        Returns a new Traversable without its first element.
        Specified by:
        tail in interface IndexedSeq<java.lang.Character>
        Specified by:
        tail in interface Seq<java.lang.Character>
        Specified by:
        tail in interface Traversable<java.lang.Character>
        Returns:
        a new Traversable containing all elements except the first
      • tailOption

        public Option<CharSeq> tailOption()
        Description copied from interface: Traversable
        Returns a new Traversable without its first element as an Option.
        Specified by:
        tailOption in interface IndexedSeq<java.lang.Character>
        Specified by:
        tailOption in interface Seq<java.lang.Character>
        Specified by:
        tailOption in interface Traversable<java.lang.Character>
        Returns:
        Some(traversable) if non-empty, otherwise None
      • take

        public CharSeq take​(int n)
        Description copied from interface: Traversable
        Returns the first n elements of this Traversable, or all elements if n exceeds the length.

        Equivalent to sublist(0, max(0, min(length(), n))), but safe for n < 0 or n > length().

        If n < 0, an empty instance is returned. If n > length(), the full instance is returned.

        Specified by:
        take in interface IndexedSeq<java.lang.Character>
        Specified by:
        take in interface Seq<java.lang.Character>
        Specified by:
        take in interface Traversable<java.lang.Character>
        Parameters:
        n - the number of elements to take
        Returns:
        a new Traversable containing the first n elements
      • takeUntil

        public CharSeq takeUntil​(@NonNull java.util.function.Predicate<? super java.lang.Character> predicate)
        Description copied from interface: Traversable
        Takes elements from this Traversable until the given predicate holds for an element.

        Equivalent to takeWhile(predicate.negate()), but useful when using method references that cannot be negated directly.

        Specified by:
        takeUntil in interface IndexedSeq<java.lang.Character>
        Specified by:
        takeUntil in interface Seq<java.lang.Character>
        Specified by:
        takeUntil in interface Traversable<java.lang.Character>
        Parameters:
        predicate - a condition tested sequentially on the elements
        Returns:
        a new Traversable containing all elements before the first one that satisfies the predicate
      • takeWhile

        public CharSeq takeWhile​(@NonNull java.util.function.Predicate<? super java.lang.Character> predicate)
        Description copied from interface: Traversable
        Takes elements from this Traversable while the given predicate holds.
        Specified by:
        takeWhile in interface IndexedSeq<java.lang.Character>
        Specified by:
        takeWhile in interface Seq<java.lang.Character>
        Specified by:
        takeWhile in interface Traversable<java.lang.Character>
        Parameters:
        predicate - a condition tested sequentially on the elements
        Returns:
        a new Traversable containing all elements up to (but not including) the first one that does not satisfy the predicate
      • takeRight

        public CharSeq takeRight​(int n)
        Description copied from interface: Traversable
        Returns the last n elements of this Traversable, or all elements if n exceeds the length.

        Equivalent to sublist(max(0, length() - n), length()), but safe for n < 0 or n > length().

        If n < 0, an empty instance is returned. If n > length(), the full instance is returned.

        Specified by:
        takeRight in interface IndexedSeq<java.lang.Character>
        Specified by:
        takeRight in interface Seq<java.lang.Character>
        Specified by:
        takeRight in interface Traversable<java.lang.Character>
        Parameters:
        n - the number of elements to take from the end
        Returns:
        a new Traversable containing the last n elements
      • takeRightUntil

        public CharSeq takeRightUntil​(@NonNull java.util.function.Predicate<? super java.lang.Character> predicate)
        Description copied from interface: Seq
        Takes elements from the end of the sequence until an element satisfies the given predicate. The returned sequence starts after the last element that satisfies the predicate.
        Specified by:
        takeRightUntil in interface IndexedSeq<java.lang.Character>
        Specified by:
        takeRightUntil in interface Seq<java.lang.Character>
        Parameters:
        predicate - a condition to test elements, starting from the end
        Returns:
        a new sequence containing all elements after the last element that satisfies the predicate
      • takeRightWhile

        public CharSeq takeRightWhile​(@NonNull java.util.function.Predicate<? super java.lang.Character> predicate)
        Description copied from interface: Seq
        Takes elements from the end of the sequence while the given predicate holds.

        This is an equivalent to takeRightUntil(predicate.negate()). Useful when using method references that cannot be negated directly.

        Specified by:
        takeRightWhile in interface IndexedSeq<java.lang.Character>
        Specified by:
        takeRightWhile in interface Seq<java.lang.Character>
        Parameters:
        predicate - a condition to test elements, starting from the end
        Returns:
        a new sequence containing all elements after the last element that does not satisfy the predicate
      • transform

        public <U> U transform​(java.util.function.Function<? super CharSeq,​? extends U> f)
        Transforms this CharSeq.
        Type Parameters:
        U - Type of transformation result
        Parameters:
        f - A transformation
        Returns:
        An instance of type U
        Throws:
        java.lang.NullPointerException - if f is null
      • unzip

        public <T1,​T2> Tuple2<IndexedSeq<T1>,​IndexedSeq<T2>> unzip​(@NonNull java.util.function.Function<? super java.lang.Character,​Tuple2<? extends T1,​? extends T2>> unzipper)
        Description copied from interface: Traversable
        Unzips the elements of this Traversable by mapping each element to a pair and splitting them into two separate Traversable collections.
        Specified by:
        unzip in interface IndexedSeq<java.lang.Character>
        Specified by:
        unzip in interface Seq<java.lang.Character>
        Specified by:
        unzip in interface Traversable<java.lang.Character>
        Type Parameters:
        T1 - type of the first element in the resulting pairs
        T2 - type of the second element in the resulting pairs
        Parameters:
        unzipper - a function that maps elements of this Traversable to pairs
        Returns:
        a Tuple2 containing two Traversable collections with the split elements
      • unzip3

        public <T1,​T2,​T3> Tuple3<IndexedSeq<T1>,​IndexedSeq<T2>,​IndexedSeq<T3>> unzip3​(@NonNull java.util.function.Function<? super java.lang.Character,​Tuple3<? extends T1,​? extends T2,​? extends T3>> unzipper)
        Description copied from interface: Traversable
        Unzips the elements of this Traversable by mapping each element to a triple and splitting them into three separate Traversable collections.
        Specified by:
        unzip3 in interface IndexedSeq<java.lang.Character>
        Specified by:
        unzip3 in interface Seq<java.lang.Character>
        Specified by:
        unzip3 in interface Traversable<java.lang.Character>
        Type Parameters:
        T1 - type of the first element in the resulting triples
        T2 - type of the second element in the resulting triples
        T3 - type of the third element in the resulting triples
        Parameters:
        unzipper - a function that maps elements of this Traversable to triples
        Returns:
        a Tuple3 containing three Traversable collections with the split elements
      • update

        public CharSeq update​(int index,
                              java.lang.Character element)
        Description copied from interface: Seq
        Returns a new Seq with the element at the specified index replaced by the given value.
        Specified by:
        update in interface IndexedSeq<java.lang.Character>
        Specified by:
        update in interface Seq<java.lang.Character>
        Parameters:
        index - the index of the element to update
        element - the new element to set at the specified index
        Returns:
        a new Seq with the updated element
      • update

        public CharSeq update​(int index,
                              @NonNull java.util.function.Function<? super java.lang.Character,​? extends java.lang.Character> updater)
        Description copied from interface: Seq
        Returns a new Seq with the element at the specified index updated using the given function.
        Specified by:
        update in interface IndexedSeq<java.lang.Character>
        Specified by:
        update in interface Seq<java.lang.Character>
        Parameters:
        index - the index of the element to update
        updater - a function that computes the new element from the existing element
        Returns:
        a new Seq with the element at index transformed by updater
      • zip

        public <U> IndexedSeq<Tuple2<java.lang.Character,​U>> zip​(@NonNull java.lang.Iterable<? extends U> that)
        Description copied from interface: Traversable
        Returns a Traversable formed by pairing elements of this Traversable with elements of another Iterable. Pairing stops when either collection runs out of elements; any remaining elements in the longer collection are ignored.

        The length of the resulting Traversable is the minimum of the lengths of this Traversable and that.

        Specified by:
        zip in interface IndexedSeq<java.lang.Character>
        Specified by:
        zip in interface Seq<java.lang.Character>
        Specified by:
        zip in interface Traversable<java.lang.Character>
        Type Parameters:
        U - the type of elements in the second half of each pair
        Parameters:
        that - an Iterable providing the second element of each pair
        Returns:
        a new Traversable containing pairs of corresponding elements
      • zipWith

        public <U,​R> IndexedSeq<R> zipWith​(@NonNull java.lang.Iterable<? extends U> that,
                                                 java.util.function.BiFunction<? super java.lang.Character,​? super U,​? extends R> mapper)
        Description copied from interface: Traversable
        Returns a Traversable by combining elements of this Traversable with elements of another Iterable using a mapping function. Pairing stops when either collection runs out of elements.

        The length of the resulting Traversable is the minimum of the lengths of this Traversable and that.

        Specified by:
        zipWith in interface IndexedSeq<java.lang.Character>
        Specified by:
        zipWith in interface Seq<java.lang.Character>
        Specified by:
        zipWith in interface Traversable<java.lang.Character>
        Type Parameters:
        U - the type of elements in the second parameter of the mapper
        R - the type of elements in the resulting Traversable
        Parameters:
        that - an Iterable providing the second parameter of the mapper
        mapper - a function that combines elements from this and that into a new element
        Returns:
        a new Traversable containing mapped elements
      • zipAll

        public <U> IndexedSeq<Tuple2<java.lang.Character,​U>> zipAll​(@NonNull java.lang.Iterable<? extends U> that,
                                                                          java.lang.Character thisElem,
                                                                          U thatElem)
        Description copied from interface: Traversable
        Returns a Traversable formed by pairing elements of this Traversable with elements of another Iterable, filling in placeholder elements when one collection is shorter than the other.

        The length of the resulting Traversable is the maximum of the lengths of this Traversable and that.

        If this Traversable is shorter than that, thisElem is used as a filler. Conversely, if that is shorter, thatElem is used.

        Specified by:
        zipAll in interface IndexedSeq<java.lang.Character>
        Specified by:
        zipAll in interface Seq<java.lang.Character>
        Specified by:
        zipAll in interface Traversable<java.lang.Character>
        Type Parameters:
        U - the type of elements in the second half of each pair
        Parameters:
        that - an Iterable providing the second element of each pair
        thisElem - the element used to fill missing values if this Traversable is shorter than that
        thatElem - the element used to fill missing values if that is shorter than this Traversable
        Returns:
        a new Traversable containing pairs of elements, including fillers as needed
      • zipWithIndex

        public IndexedSeq<Tuple2<java.lang.Character,​java.lang.Integer>> zipWithIndex()
        Description copied from interface: Traversable
        Zips this Traversable with its indices, starting at 0.
        Specified by:
        zipWithIndex in interface IndexedSeq<java.lang.Character>
        Specified by:
        zipWithIndex in interface Seq<java.lang.Character>
        Specified by:
        zipWithIndex in interface Traversable<java.lang.Character>
        Returns:
        a new Traversable containing each element paired with its index
      • zipWithIndex

        public <U> IndexedSeq<U> zipWithIndex​(@NonNull java.util.function.BiFunction<? super java.lang.Character,​? super java.lang.Integer,​? extends U> mapper)
        Description copied from interface: Traversable
        Zips this Traversable with its indices and maps the resulting pairs using the provided mapper.
        Specified by:
        zipWithIndex in interface IndexedSeq<java.lang.Character>
        Specified by:
        zipWithIndex in interface Seq<java.lang.Character>
        Specified by:
        zipWithIndex in interface Traversable<java.lang.Character>
        Type Parameters:
        U - the type of elements in the resulting Traversable
        Parameters:
        mapper - a function mapping an element and its index to a new element
        Returns:
        a new Traversable containing the mapped elements
      • get

        public java.lang.Character get​(int index)
        Description copied from interface: Seq
        Returns the element at the specified index.
        Specified by:
        get in interface Seq<java.lang.Character>
        Parameters:
        index - the position of the element to retrieve
        Returns:
        the element at the given index
      • indexOf

        public int indexOf​(java.lang.Character element,
                           int from)
        Description copied from interface: Seq
        Returns the index of the first occurrence of the given element, starting at the specified index, or -1 if this sequence does not contain the element.
        Specified by:
        indexOf in interface Seq<java.lang.Character>
        Parameters:
        element - the element to search for
        from - the starting index for the search
        Returns:
        the index of the first occurrence at or after from, or -1 if not found
      • lastIndexOf

        public int lastIndexOf​(java.lang.Character element,
                               int end)
        Description copied from interface: Seq
        Returns the index of the last occurrence of the given element at or before the specified end index, or -1 if this sequence does not contain the element.
        Specified by:
        lastIndexOf in interface Seq<java.lang.Character>
        Parameters:
        element - the element to search for
        end - the maximum index to consider
        Returns:
        the index of the last occurrence at or before end, or -1 if not found
      • splitAt

        public Tuple2<CharSeq,​CharSeq> splitAt​(int n)
        Description copied from interface: Seq
        Splits this sequence at the specified index.

        The result of splitAt(n) is equivalent to Tuple.of(take(n), drop(n)).

        Specified by:
        splitAt in interface Seq<java.lang.Character>
        Parameters:
        n - the index at which to split
        Returns:
        a Tuple2 containing the first n elements and the remaining elements
      • splitAt

        public Tuple2<CharSeq,​CharSeq> splitAt​(@NonNull java.util.function.Predicate<? super java.lang.Character> predicate)
        Description copied from interface: Seq
        Splits this sequence at the first element satisfying the given predicate.
        Specified by:
        splitAt in interface Seq<java.lang.Character>
        Parameters:
        predicate - the predicate used to determine the split point; must not be null
        Returns:
        a Tuple2 containing the sequence before the first matching element and the remaining sequence
      • splitAtInclusive

        public Tuple2<CharSeq,​CharSeq> splitAtInclusive​(@NonNull java.util.function.Predicate<? super java.lang.Character> predicate)
        Description copied from interface: Seq
        Splits this sequence at the first element satisfying the given predicate, including the element in the first part.
        Specified by:
        splitAtInclusive in interface Seq<java.lang.Character>
        Parameters:
        predicate - the predicate used to determine the split point; must not be null
        Returns:
        a Tuple2 containing the sequence up to and including the first matching element and the remaining sequence
      • startsWith

        public boolean startsWith​(@NonNull java.lang.Iterable<? extends java.lang.Character> that,
                                  int offset)
        Description copied from interface: Seq
        Tests whether this sequence contains the given sequence starting at the specified index.

        Note: If both this sequence and the argument sequence are infinite, this method may not terminate.

        Specified by:
        startsWith in interface IndexedSeq<java.lang.Character>
        Specified by:
        startsWith in interface Seq<java.lang.Character>
        Parameters:
        that - the sequence to test; must not be null
        offset - the index at which to start checking for the prefix
        Returns:
        true if that is empty or matches a subsequence of this sequence starting at offset, false otherwise
      • head

        public java.lang.Character head()
        Description copied from interface: Traversable
        Returns the first element of this non-empty Traversable.
        Specified by:
        head in interface Traversable<java.lang.Character>
        Returns:
        the first element
      • isAsync

        public boolean isAsync()
        A CharSeq is computed synchronously.
        Specified by:
        isAsync in interface Value<java.lang.Character>
        Returns:
        false
      • isEmpty

        public boolean isEmpty()
        Description copied from interface: Traversable
        Checks if this Traversable contains no elements.
        Specified by:
        isEmpty in interface Traversable<java.lang.Character>
        Specified by:
        isEmpty in interface Value<java.lang.Character>
        Returns:
        true if empty, false otherwise
      • isLazy

        public boolean isLazy()
        A CharSeq is computed eagerly.
        Specified by:
        isLazy in interface Value<java.lang.Character>
        Returns:
        false
      • isTraversableAgain

        public boolean isTraversableAgain()
        Description copied from interface: Traversable
        Checks if this Traversable can be traversed multiple times without side effects.

        Implementations should provide the correct behavior; this is not meant for interfaces alone.

        Specified by:
        isTraversableAgain in interface Traversable<java.lang.Character>
        Returns:
        true if this Traversable is guaranteed to be repeatably traversable, false otherwise
      • readResolve

        private java.lang.Object readResolve()
      • equals

        public boolean equals​(java.lang.Object o)
        Description copied from interface: Traversable
        Determines whether this collection is equal to the given object.

        In Vavr, there are four basic collection types:

        • Seq – sequential elements
        • Set – distinct elements
        • Map – key-value pairs
        • Multimap – keys mapped to multiple values
        Two collections are considered equal if and only if:
        • They are of the same collection type (Seq, Set, Map, Multimap)
        • They contain the same elements
        • For Seq, the element order is the same

        For Map and Multimap, two entries (key1, value1) and (key2, value2) are equal if both their keys and values are equal.

        Additional notes:

        • No collection equals null (e.g., Queue(1) != null)
        • Null elements are allowed and treated as expected (e.g., List(null, 1) == Stream(null, 1), HashMap((null,1)) == LinkedHashMap((null,1)))
        • Element order matters only for Seq
        • Other collection classes are equal if their types and elements (in iteration order) are equal
        • Iterators are compared by reference only
        Specified by:
        equals in interface Traversable<java.lang.Character>
        Specified by:
        equals in interface Value<java.lang.Character>
        Overrides:
        equals in class java.lang.Object
        Parameters:
        o - the object to compare with, may be null
        Returns:
        true if the collections are equal according to the rules above, false otherwise
      • hashCode

        public int hashCode()
        Description copied from interface: Traversable
        Returns the hash code of this collection.

        Vavr distinguishes between collections with predictable iteration order (like Seq) and collections with arbitrary iteration order (like Set, Map, and Multimap). In all cases, the hash of an empty collection is defined as 1.

        For collections with predictable iteration order, the hash is computed as:

        
         int hash = 1;
         for (T t : this) {
             hash = hash * 31 + Objects.hashCode(t);
         }
         

        For collections with arbitrary iteration order, the hash is computed to be independent of element order:

        
         int hash = 1;
         for (T t : this) {
             hash += Objects.hashCode(t);
         }
         

        Note that these algorithms may change in future Vavr versions. Hash codes are generally not cached, unlike size/length, because caching would increase memory usage due to persistent tree-based structures. Computing the hash code is linear in time, O(n). For frequently re-used collections (e.g., as HashMap keys), caching can be done externally using a wrapper, for example:

        {@code
         public final class Hashed {
             private final K key;
             private final Lazy hashCode;
        
             public Hashed(K key) {
                 this.key = key;
                 this.hashCode = Lazy.of(() -> Objects.hashCode(key));
             }
        
             public K key() { return key; }
        Specified by:
        hashCode in interface Traversable<java.lang.Character>
        Specified by:
        hashCode in interface Value<java.lang.Character>
        Overrides:
        hashCode in class java.lang.Object
        Returns:
        the hash code of this collection
      • charAt

        public char charAt​(int index)
        Returns the char value at the specified index. An index ranges from 0 to length() - 1. The first char value of the sequence is at index 0, the next at index 1, and so on, as for array indexing.

        If the char value specified by the index is a surrogate, the surrogate value is returned.

        Specified by:
        charAt in interface java.lang.CharSequence
        Parameters:
        index - the index of the char value.
        Returns:
        the char value at the specified index of this string. The first char value is at index 0.
        Throws:
        java.lang.IndexOutOfBoundsException - if the index argument is negative or not less than the length of this string.
      • length

        public int length()
        Returns the length of this string. The length is equal to the number of Unicode code units in the string.
        Specified by:
        length in interface java.lang.CharSequence
        Specified by:
        length in interface Traversable<java.lang.Character>
        Returns:
        the length of the sequence of characters represented by this object.
      • codePointAt

        public int codePointAt​(int index)
        Returns the character (Unicode code point) at the specified index. The index refers to char values (Unicode code units) and ranges from 0 to length() - 1.

        If the char value specified at the given index is in the high-surrogate range, the following index is less than the length of this CharSeq, and the char value at the following index is in the low-surrogate range, then the supplementary code point corresponding to this surrogate pair is returned. Otherwise, the char value at the given index is returned.

        Parameters:
        index - the index to the char values
        Returns:
        the code point value of the character at the index
        Throws:
        java.lang.IndexOutOfBoundsException - if the index argument is negative or not less than the length of this string.
      • codePointBefore

        public int codePointBefore​(int index)
        Returns the character (Unicode code point) before the specified index. The index refers to char values (Unicode code units) and ranges from 1 to length.

        If the char value at (index - 1) is in the low-surrogate range, (index - 2) is not negative, and the char value at (index - 2) is in the high-surrogate range, then the supplementary code point value of the surrogate pair is returned. If the char value at index - 1 is an unpaired low-surrogate or a high-surrogate, the surrogate value is returned.

        Parameters:
        index - the index following the code point that should be returned
        Returns:
        the Unicode code point value before the given index.
        Throws:
        java.lang.IndexOutOfBoundsException - if the index argument is less than 1 or greater than the length of this string.
      • codePointCount

        public int codePointCount​(int beginIndex,
                                  int endIndex)
        Returns the number of Unicode code points in the specified text range of this CharSeq. The text range begins at the specified beginIndex and extends to the char at index endIndex - 1. Thus the length (in chars) of the text range is endIndex-beginIndex. Unpaired surrogates within the text range count as one code point each.
        Parameters:
        beginIndex - the index to the first char of the text range.
        endIndex - the index after the last char of the text range.
        Returns:
        the number of Unicode code points in the specified text range
        Throws:
        java.lang.IndexOutOfBoundsException - if the beginIndex is negative, or endIndex is larger than the length of this CharSeq, or beginIndex is larger than endIndex.
      • offsetByCodePoints

        public int offsetByCodePoints​(int index,
                                      int codePointOffset)
        Returns the index within this CharSeq that is offset from the given index by codePointOffset code points. Unpaired surrogates within the text range given by index and codePointOffset count as one code point each.
        Parameters:
        index - the index to be offset
        codePointOffset - the offset in code points
        Returns:
        the index within this CharSeq
        Throws:
        java.lang.IndexOutOfBoundsException - if index is negative or larger then the length of this CharSeq, or if codePointOffset is positive and the substring starting with index has fewer than codePointOffset code points, or if codePointOffset is negative and the substring before index has fewer than the absolute value of codePointOffset code points.
      • getChars

        public void getChars​(int srcBegin,
                             int srcEnd,
                             char[] dst,
                             int dstBegin)
        Copies characters from this string into the destination character array.

        The first character to be copied is at index srcBegin; the last character to be copied is at index srcEnd-1 (thus the total number of characters to be copied is srcEnd-srcBegin). The characters are copied into the subarray of dst starting at index dstBegin and ending at index:

             dstbegin + (srcEnd-srcBegin) - 1
         
        Parameters:
        srcBegin - index of the first character in the string to copy.
        srcEnd - index after the last character in the string to copy.
        dst - the destination array.
        dstBegin - the start offset in the destination array.
        Throws:
        java.lang.IndexOutOfBoundsException - If any of the following is true:
        • srcBegin is negative.
        • srcBegin is greater than srcEnd
        • srcEnd is greater than the length of this string
        • dstBegin is negative
        • dstBegin+(srcEnd-srcBegin) is larger than dst.length
      • getBytes

        public byte[] getBytes​(java.lang.String charsetName)
                        throws java.io.UnsupportedEncodingException
        Encodes this CharSeq into a sequence of bytes using the named charset, storing the result into a new byte array.

        The behavior of this method when this string cannot be encoded in the given charset is unspecified. The CharsetEncoder class should be used when more control over the encoding process is required.

        Parameters:
        charsetName - The name of a supported charset
        Returns:
        The resultant byte array
        Throws:
        java.io.UnsupportedEncodingException - If the named charset is not supported
      • getBytes

        public byte[] getBytes​(java.nio.charset.Charset charset)
        Encodes this CharSeq into a sequence of bytes using the given charset, storing the result into a new byte array.

        This method always replaces malformed-input and unmappable-character sequences with this charset's default replacement byte array. The CharsetEncoder class should be used when more control over the encoding process is required.

        Parameters:
        charset - The Charset to be used to encode the CharSeq
        Returns:
        The resultant byte array
      • getBytes

        public byte[] getBytes()
        Encodes this CharSeq into a sequence of bytes using the platform's default charset, storing the result into a new byte array.

        The behavior of this method when this string cannot be encoded in the default charset is unspecified. The CharsetEncoder class should be used when more control over the encoding process is required.

        Returns:
        The resultant byte array
      • contentEquals

        public boolean contentEquals​(java.lang.StringBuffer sb)
        Compares this string to the specified StringBuffer. The result is true if and only if this CharSeq represents the same sequence of characters as the specified StringBuffer. This method synchronizes on the StringBuffer.
        Parameters:
        sb - The StringBuffer to compare this CharSeq against
        Returns:
        true if this CharSeq represents the same sequence of characters as the specified StringBuffer, false otherwise
      • contentEquals

        public boolean contentEquals​(java.lang.CharSequence cs)
        Compares this string to the specified CharSequence. The result is true if and only if this CharSeq represents the same sequence of char values as the specified sequence. Note that if the CharSequence is a StringBuffer then the method synchronizes on it.
        Parameters:
        cs - The sequence to compare this CharSeq against
        Returns:
        true if this CharSeq represents the same sequence of char values as the specified sequence, false otherwise
      • equalsIgnoreCase

        public boolean equalsIgnoreCase​(CharSeq anotherString)
        Compares this CharSeq to another CharSeq, ignoring case considerations. Two strings are considered equal ignoring case if they are of the same length and corresponding characters in the two strings are equal ignoring case.

        Two characters c1 and c2 are considered the same ignoring case if at least one of the following is true:

        • The two characters are the same (as compared by the == operator)
        • Applying the method Character.toUpperCase(char) to each character produces the same result
        • Applying the method Character.toLowerCase(char) to each character produces the same result
        Parameters:
        anotherString - The CharSeq to compare this CharSeq against
        Returns:
        true if the argument is not null and it represents an equivalent CharSeq ignoring case; false otherwise
        See Also:
        equals(Object)
      • compareTo

        public int compareTo​(CharSeq anotherString)
        Compares two strings lexicographically. The comparison is based on the Unicode value of each character in the strings. The character sequence represented by this CharSeq object is compared lexicographically to the character sequence represented by the argument string. The result is a negative integer if this CharSeq object lexicographically precedes the argument string. The result is a positive integer if this CharSeq object lexicographically follows the argument string. The result is zero if the strings are equal; compareTo returns 0 exactly when the equals(Object) method would return true.

        This is the definition of lexicographic ordering. If two strings are different, then either they have different characters at some index that is a valid index for both strings, or their lengths are different, or both. If they have different characters at one or more index positions, let k be the smallest such index; then the string whose character at position k has the smaller value, as determined by using the < operator, lexicographically precedes the other string. In this case, compareTo returns the difference of the two character values at position k in the two string -- that is, the value:

         this.charAt(k)-anotherString.charAt(k)
         
        If there is no index position at which they differ, then the shorter string lexicographically precedes the longer string. In this case, compareTo returns the difference of the lengths of the strings -- that is, the value:
         this.length()-anotherString.length()
         
        Specified by:
        compareTo in interface java.lang.Comparable<CharSeq>
        Parameters:
        anotherString - the CharSeq to be compared.
        Returns:
        the value 0 if the argument string is equal to this string; a value less than 0 if this string is lexicographically less than the string argument; and a value greater than 0 if this string is lexicographically greater than the string argument.
      • compareToIgnoreCase

        public int compareToIgnoreCase​(CharSeq str)
        Compares two strings lexicographically, ignoring case differences. This method returns an integer whose sign is that of calling compareTo with normalized versions of the strings where case differences have been eliminated by calling Character.toLowerCase(Character.toUpperCase(character)) on each character.

        Note that this method does not take locale into account, and will result in an unsatisfactory ordering for certain locales. The java.text package provides collators to allow locale-sensitive ordering.

        Parameters:
        str - the CharSeq to be compared.
        Returns:
        a negative integer, zero, or a positive integer as the specified String is greater than, equal to, or less than this String, ignoring case considerations.
      • regionMatches

        public boolean regionMatches​(int toffset,
                                     CharSeq other,
                                     int ooffset,
                                     int len)
        Tests if two string regions are equal.

        A substring of this CharSeq object is compared to a substring of the argument other. The result is true if these substrings represent identical character sequences. The substring of this CharSeq object to be compared begins at index toffset and has length len. The substring of other to be compared begins at index ooffset and has length len. The result is false if and only if at least one of the following is true:

        • toffset is negative.
        • ooffset is negative.
        • toffset+len is greater than the length of this CharSeq object.
        • ooffset+len is greater than the length of the other argument.
        • There is some nonnegative integer k less than len such that: this.charAt(toffset + k) != other.charAt(ooffset + k)
        Parameters:
        toffset - the starting offset of the subregion in this string.
        other - the string argument.
        ooffset - the starting offset of the subregion in the string argument.
        len - the number of characters to compare.
        Returns:
        true if the specified subregion of this string exactly matches the specified subregion of the string argument; false otherwise.
      • regionMatches

        public boolean regionMatches​(boolean ignoreCase,
                                     int toffset,
                                     CharSeq other,
                                     int ooffset,
                                     int len)
        Tests if two string regions are equal.

        A substring of this CharSeq object is compared to a substring of the argument other. The result is true if these substrings represent character sequences that are the same, ignoring case if and only if ignoreCase is true. The substring of this CharSeq object to be compared begins at index toffset and has length len. The substring of other to be compared begins at index ooffset and has length len. The result is false if and only if at least one of the following is true:

        • toffset is negative.
        • ooffset is negative.
        • toffset+len is greater than the length of this CharSeq object.
        • ooffset+len is greater than the length of the other argument.
        • ignoreCase is false and there is some nonnegative integer k less than len such that:
           this.charAt(toffset+k) != other.charAt(ooffset+k)
           
        • ignoreCase is true and there is some nonnegative integer k less than len such that:
           Character.toLowerCase(this.charAt(toffset+k)) !=
           Character.toLowerCase(other.charAt(ooffset+k))
           
          and:
           Character.toUpperCase(this.charAt(toffset+k)) !=
                   Character.toUpperCase(other.charAt(ooffset+k))
           
        Parameters:
        ignoreCase - if true, ignore case when comparing characters.
        toffset - the starting offset of the subregion in this string.
        other - the string argument.
        ooffset - the starting offset of the subregion in the string argument.
        len - the number of characters to compare.
        Returns:
        true if the specified subregion of this string matches the specified subregion of the string argument; false otherwise. Whether the matching is exact or case insensitive depends on the ignoreCase argument.
      • subSequence

        public CharSeq subSequence​(int beginIndex,
                                   int endIndex)
        Description copied from interface: Seq
        Returns a Seq that is a subsequence of this sequence, starting from the specified beginIndex (inclusive) and ending at endIndex (exclusive).

        Examples:

        
         List.of(1, 2, 3, 4).subSequence(1, 3); // = (2, 3)
         List.of(1, 2, 3, 4).subSequence(0, 4); // = (1, 2, 3, 4)
         List.of(1, 2, 3, 4).subSequence(2, 2); // = ()
         List.of(1, 2).subSequence(1, 0);       // throws IndexOutOfBoundsException
         List.of(1, 2).subSequence(-10, 1);     // throws IndexOutOfBoundsException
         List.of(1, 2).subSequence(0, 10);      // throws IndexOutOfBoundsException
         

        See also Seq.slice(int, int), which returns an empty sequence instead of throwing exceptions when indices are out of range.

        Specified by:
        subSequence in interface java.lang.CharSequence
        Specified by:
        subSequence in interface IndexedSeq<java.lang.Character>
        Specified by:
        subSequence in interface Seq<java.lang.Character>
        Parameters:
        beginIndex - the starting index (inclusive) of the subsequence
        endIndex - the ending index (exclusive) of the subsequence
        Returns:
        a new Seq representing the subsequence from beginIndex to endIndex - 1
      • startsWith

        public boolean startsWith​(CharSeq prefix,
                                  int toffset)
        Tests if the substring of this string beginning at the specified index starts with the specified prefix.
        Parameters:
        prefix - the prefix.
        toffset - where to begin looking in this string.
        Returns:
        true if the character sequence represented by the argument is a prefix of the substring of this object starting at index toffset; false otherwise. The result is false if toffset is negative or greater than the length of this CharSeq object; otherwise the result is the same as the result of the expression
                  this.substring(toffset).startsWith(prefix)
                  
      • startsWith

        public boolean startsWith​(CharSeq prefix)
        Tests if this string starts with the specified prefix.
        Parameters:
        prefix - the prefix.
        Returns:
        true if the character sequence represented by the argument is a prefix of the character sequence represented by this string; false otherwise. Note also that true will be returned if the argument is an empty string or is equal to this CharSeq object as determined by the equals(Object) method.
      • endsWith

        public boolean endsWith​(CharSeq suffix)
        Tests if this string ends with the specified suffix.
        Parameters:
        suffix - the suffix.
        Returns:
        true if the character sequence represented by the argument is a suffix of the character sequence represented by this object; false otherwise. Note that the result will be true if the argument is the empty string or is equal to this CharSeq object as determined by the equals(Object) method.
      • indexOf

        public int indexOf​(int ch)
        Returns the index within this string of the first occurrence of the specified character. If a character with value ch occurs in the character sequence represented by this CharSeq object, then the index (in Unicode code units) of the first such occurrence is returned. For values of ch in the range from 0 to 0xFFFF (inclusive), this is the smallest value k such that:
         this.charAt(k) == ch
         
        is true. For other values of ch, it is the smallest value k such that:
         this.codePointAt(k) == ch
         
        is true. In either case, if no such character occurs in this string, then -1 is returned.
        Parameters:
        ch - a character (Unicode code point).
        Returns:
        the index of the first occurrence of the character in the character sequence represented by this object, or -1 if the character does not occur.
      • indexOfOption

        Option<java.lang.Integer> indexOfOption​(int ch)
        Returns the index of the first occurrence of the given element as an Option.
        Parameters:
        ch - a character (Unicode code point).
        Returns:
        Some(index) or None if not found.
      • indexOf

        public int indexOf​(int ch,
                           int fromIndex)
        Returns the index within this string of the first occurrence of the specified character, starting the search at the specified index.

        If a character with value ch occurs in the character sequence represented by this CharSeq object at an index no smaller than fromIndex, then the index of the first such occurrence is returned. For values of ch in the range from 0 to 0xFFFF (inclusive), this is the smallest value k such that:

         (this.charAt(k) == ch) && (k >= fromIndex)
         
        is true. For other values of ch, it is the smallest value k such that:
         (this.codePointAt(k) == ch) && (k >= fromIndex)
         
        is true. In either case, if no such character occurs in this string at or after position fromIndex, then -1 is returned.

        There is no restriction on the value of fromIndex. If it is negative, it has the same effect as if it were zero: this entire string may be searched. If it is greater than the length of this string, it has the same effect as if it were equal to the length of this string: -1 is returned.

        All indices are specified in char values (Unicode code units).

        Parameters:
        ch - a character (Unicode code point).
        fromIndex - the index to start the search from.
        Returns:
        the index of the first occurrence of the character in the character sequence represented by this object that is greater than or equal to fromIndex, or -1 if the character does not occur.
      • indexOfOption

        Option<java.lang.Integer> indexOfOption​(int ch,
                                                int fromIndex)
        Returns the index of the first occurrence of the given element as an Option, starting the search at the specified index.
        Parameters:
        ch - a character (Unicode code point).
        fromIndex - the index to start the search from.
        Returns:
        Some(index) or None if not found.
      • lastIndexOf

        public int lastIndexOf​(int ch)
        Returns the index within this string of the last occurrence of the specified character. For values of ch in the range from 0 to 0xFFFF (inclusive), the index (in Unicode code units) returned is the largest value k such that:
         this.charAt(k) == ch
         
        is true. For other values of ch, it is the largest value k such that:
         this.codePointAt(k) == ch
         
        is true. In either case, if no such character occurs in this string, then -1 is returned. The CharSeq is searched backwards starting at the last character.
        Parameters:
        ch - a character (Unicode code point).
        Returns:
        the index of the last occurrence of the character in the character sequence represented by this object, or -1 if the character does not occur.
      • lastIndexOfOption

        Option<java.lang.Integer> lastIndexOfOption​(int ch)
        Returns the index of the last occurrence of the given element as an Option.
        Parameters:
        ch - a character (Unicode code point).
        Returns:
        Some(index) or None if not found.
      • lastIndexOf

        public int lastIndexOf​(int ch,
                               int fromIndex)
        Returns the index within this string of the last occurrence of the specified character, searching backward starting at the specified index. For values of ch in the range from 0 to 0xFFFF (inclusive), the index returned is the largest value k such that:
         (this.charAt(k) == ch) && (k <= fromIndex)
         
        is true. For other values of ch, it is the largest value k such that:
         (this.codePointAt(k) == ch) && (k <= fromIndex)
         
        is true. In either case, if no such character occurs in this string at or before position fromIndex, then -1 is returned.

        All indices are specified in char values (Unicode code units).

        Parameters:
        ch - a character (Unicode code point).
        fromIndex - the index to start the search from. There is no restriction on the value of fromIndex. If it is greater than or equal to the length of this string, it has the same effect as if it were equal to one less than the length of this string: this entire string may be searched. If it is negative, it has the same effect as if it were -1: -1 is returned.
        Returns:
        the index of the last occurrence of the character in the character sequence represented by this object that is less than or equal to fromIndex, or -1 if the character does not occur before that point.
      • lastIndexOfOption

        public Option<java.lang.Integer> lastIndexOfOption​(int ch,
                                                           int fromIndex)
        Returns the index of the last occurrence of the given element as an Option, starting the search at the specified index.
        Parameters:
        ch - a character (Unicode code point).
        fromIndex - the index to start the search from.
        Returns:
        Some(index) or None if not found.
      • indexOf

        public int indexOf​(CharSeq str)
        Returns the index within this string of the first occurrence of the specified substring.

        The returned index is the smallest value k for which:

         this.startsWith(str, k)
         
        If no such value of k exists, then -1 is returned.
        Parameters:
        str - the substring to search for.
        Returns:
        the index of the first occurrence of the specified substring, or -1 if there is no such occurrence.
      • indexOfOption

        public Option<java.lang.Integer> indexOfOption​(CharSeq str)
        Returns the index of the first occurrence of the given element as an Option.
        Parameters:
        str - the substring to search for.
        Returns:
        Some(index) or None if not found.
      • indexOf

        public int indexOf​(CharSeq str,
                           int fromIndex)
        Returns the index within this string of the first occurrence of the specified substring, starting at the specified index.

        The returned index is the smallest value k for which:

         k >= fromIndex && this.startsWith(str, k)
         
        If no such value of k exists, then -1 is returned.
        Parameters:
        str - the substring to search for.
        fromIndex - the index from which to start the search.
        Returns:
        the index of the first occurrence of the specified substring, starting at the specified index, or -1 if there is no such occurrence.
      • indexOfOption

        public Option<java.lang.Integer> indexOfOption​(CharSeq str,
                                                       int fromIndex)
        Returns the index of the first occurrence of the given element as an Option, starting the search at the specified index.
        Parameters:
        str - the substring to search for.
        fromIndex - the index from which to start the search.
        Returns:
        Some(index) or None if not found.
      • lastIndexOf

        public int lastIndexOf​(CharSeq str)
        Returns the index within this string of the last occurrence of the specified substring. The last occurrence of the empty string "" is considered to occur at the index value this.length().

        The returned index is the largest value k for which:

         this.startsWith(str, k)
         
        If no such value of k exists, then -1 is returned.
        Parameters:
        str - the substring to search for.
        Returns:
        the index of the last occurrence of the specified substring, or -1 if there is no such occurrence.
      • lastIndexOfOption

        public Option<java.lang.Integer> lastIndexOfOption​(CharSeq str)
        Returns the index of the last occurrence of the given element as an Option.
        Parameters:
        str - the substring to search for.
        Returns:
        Some(index) or None if not found.
      • lastIndexOf

        public int lastIndexOf​(CharSeq str,
                               int fromIndex)
        Returns the index within this string of the last occurrence of the specified substring, searching backward starting at the specified index.

        The returned index is the largest value k for which:

         k <= fromIndex && this.startsWith(str, k)
         
        If no such value of k exists, then -1 is returned.
        Parameters:
        str - the substring to search for.
        fromIndex - the index to start the search from.
        Returns:
        the index of the last occurrence of the specified substring, searching backward from the specified index, or -1 if there is no such occurrence.
      • lastIndexOfOption

        public Option<java.lang.Integer> lastIndexOfOption​(CharSeq str,
                                                           int fromIndex)
        Returns the index of the last occurrence of the given element as an Option, starting the search at the specified index.
        Parameters:
        str - the substring to search for.
        fromIndex - the index to start the search from.
        Returns:
        Some(index) or None if not found.
      • substring

        public CharSeq substring​(int beginIndex)
        Returns a string that is a substring of this string. The substring begins with the character at the specified index and extends to the end of this string.

        Examples:

         "unhappy".substring(2) returns "happy"
         "Harbison".substring(3) returns "bison"
         "emptiness".substring(9) returns "" (an empty string)
         
        Parameters:
        beginIndex - the beginning index, inclusive.
        Returns:
        the specified substring.
        Throws:
        java.lang.IndexOutOfBoundsException - if beginIndex is negative or larger than the length of this CharSeq object.
      • substring

        public CharSeq substring​(int beginIndex,
                                 int endIndex)
        Returns a string that is a substring of this string. The substring begins at the specified beginIndex and extends to the character at index endIndex - 1. Thus the length of the substring is endIndex-beginIndex.

        Examples:

         "hamburger".substring(4, 8) returns "urge"
         "smiles".substring(1, 5) returns "mile"
         
        Parameters:
        beginIndex - the beginning index, inclusive.
        endIndex - the ending index, exclusive.
        Returns:
        the specified substring.
        Throws:
        java.lang.IndexOutOfBoundsException - if the beginIndex is negative, or endIndex is larger than the length of this CharSeq object, or beginIndex is larger than endIndex.
      • stringPrefix

        public java.lang.String stringPrefix()
        Description copied from interface: Value
        Returns the name of this Value type, which is used by toString().
        Specified by:
        stringPrefix in interface Value<java.lang.Character>
        Returns:
        This type name.
      • toString

        public java.lang.String toString()
        Returns a string containing the characters in this sequence in the same order as this sequence. The length of the string will be the length of this sequence.
        Specified by:
        toString in interface java.lang.CharSequence
        Specified by:
        toString in interface Value<java.lang.Character>
        Overrides:
        toString in class java.lang.Object
        Returns:
        a string consisting of exactly this sequence of characters
      • concat

        public CharSeq concat​(CharSeq str)
        Concatenates the specified string to the end of this string.

        If the length of the argument string is 0, then this CharSeq object is returned. Otherwise, a CharSeq object is returned that represents a character sequence that is the concatenation of the character sequence represented by this CharSeq object and the character sequence represented by the argument string.

        Examples:

         "cares".concat("s") returns "caress"
         "to".concat("get").concat("her") returns "together"
         
        Parameters:
        str - the CharSeq that is concatenated to the end of this CharSeq.
        Returns:
        a string that represents the concatenation of this object's characters followed by the string argument's characters.
      • matches

        public boolean matches​(java.lang.String regex)
        Tells whether or not this string matches the given regular expression.

        An invocation of this method of the form str.matches(regex) yields exactly the same result as the expression

        Pattern.matches(regex, str)
        Parameters:
        regex - the regular expression to which this string is to be matched
        Returns:
        true if, and only if, this string matches the given regular expression
        Throws:
        java.util.regex.PatternSyntaxException - if the regular expression's syntax is invalid
        See Also:
        Pattern
      • contains

        public boolean contains​(java.lang.CharSequence s)
        Returns true if and only if this string contains the specified sequence of char values.
        Parameters:
        s - the sequence to search for
        Returns:
        true if this string contains s, false otherwise
      • replaceFirst

        public CharSeq replaceFirst​(java.lang.String regex,
                                    java.lang.String replacement)
        Replaces the first substring of this string that matches the given regular expression with the given replacement.

        An invocation of this method of the form str.replaceFirst(regex, repl) yields exactly the same result as the expression

        {@link Pattern}.{@link Pattern#compile(String) compile}(<i>regex</i>).{@link Pattern#matcher(CharSequence) matcher}(<i>str</i>).{@link java.util.regex.Matcher#replaceFirst replaceFirst}(<i>repl</i>)
        Note that backslashes (\) and dollar signs ($) in the replacement string may cause the results to be different than if it were being treated as a literal replacement string; see Matcher.replaceFirst(java.lang.String). Use Matcher.quoteReplacement(java.lang.String) to suppress the special meaning of these characters, if desired.
        Parameters:
        regex - the regular expression to which this string is to be matched
        replacement - the string to be substituted for the first match
        Returns:
        The resulting CharSeq
        Throws:
        java.util.regex.PatternSyntaxException - if the regular expression's syntax is invalid
        See Also:
        Pattern
      • replaceAll

        public CharSeq replaceAll​(java.lang.String regex,
                                  java.lang.String replacement)
        Replaces each substring of this string that matches the given regular expression with the given replacement.

        An invocation of this method of the form str.replaceAll(regex, repl) yields exactly the same result as the expression

        {@link Pattern}.{@link Pattern#compile(String) compile}(<i>regex</i>).{@link Pattern#matcher(CharSequence) matcher}(<i>str</i>).{@link java.util.regex.Matcher#replaceAll replaceAll}(<i>repl</i>)
        Note that backslashes (\) and dollar signs ($) in the replacement string may cause the results to be different than if it were being treated as a literal replacement string; see Matcher.replaceAll. Use Matcher.quoteReplacement(java.lang.String) to suppress the special meaning of these characters, if desired.
        Parameters:
        regex - the regular expression to which this string is to be matched
        replacement - the string to be substituted for each match
        Returns:
        The resulting CharSeq
        Throws:
        java.util.regex.PatternSyntaxException - if the regular expression's syntax is invalid
        See Also:
        Pattern
      • replace

        public CharSeq replace​(java.lang.CharSequence target,
                               java.lang.CharSequence replacement)
        Replaces each substring of this string that matches the literal target sequence with the specified literal replacement sequence. The replacement proceeds from the beginning of the string to the end, for example, replacing "aa" with "b" in the string "aaa" will result in "ba" rather than "ab".
        Parameters:
        target - The sequence of char values to be replaced
        replacement - The replacement sequence of char values
        Returns:
        The resulting string
      • split

        public Seq<CharSeq> split​(java.lang.String regex)
        Splits this string around matches of the given regular expression.

        This method works as if by invoking the two-argument split(String, int) method with the given expression and a limit argument of zero. Trailing empty strings are therefore not included in the resulting Seq.

        The string "boo:and:foo", for example, yields the following results with these expressions:

        Split examples showing regex and result
        Regex Result
        : { "boo", "and", "foo" }
        o { "b", "", ":and:f" }
        Parameters:
        regex - the delimiting regular expression
        Returns:
        the Seq of strings computed by splitting this string around matches of the given regular expression
        Throws:
        java.util.regex.PatternSyntaxException - if the regular expression's syntax is invalid
        See Also:
        Pattern
      • split

        public Seq<CharSeq> split​(java.lang.String regex,
                                  int limit)
        Splits this string around matches of the given regular expression.

        The array returned by this method contains each substring of this string that is terminated by another substring that matches the given expression or is terminated by the end of the string. The substrings in the array are in the order in which they occur in this string. If the expression does not match any part of the input then the resulting array has just one element, namely this string.

        When there is a positive-width match at the beginning of this string then an empty leading substring is included at the beginning of the resulting array. A zero-width match at the beginning however never produces such empty leading substring.

        The limit parameter controls the number of times the pattern is applied and therefore affects the length of the resulting array. If the limit n is greater than zero then the pattern will be applied at most n - 1 times, the array's length will be no greater than n, and the array's last entry will contain all input beyond the last matched delimiter. If n is non-positive then the pattern will be applied as many times as possible and the array can have any length. If n is zero then the pattern will be applied as many times as possible, the array can have any length, and trailing empty strings will be discarded.

        The string "boo:and:foo", for example, yields the following results with these parameters:

        Split example showing regex, limit, and result
        Regex Limit Result
        : 2 { "boo", "and:foo" }
        : 5 { "boo", "and", "foo" }
        : -2 { "boo", "and", "foo" }
        o 5 { "b", "", ":and:f", "", "" }
        o -2 { "b", "", ":and:f", "", "" }
        o 0 { "b", "", ":and:f" }
        An invocation of this method of the form str.split(regex, n) yields the same result as the expression
        {@link Pattern}.{@link Pattern#compile(String) compile}(<i>regex</i>).{@link Pattern#split(CharSequence, int) split}(<i>str</i>,&nbsp;<i>n</i>)
        Parameters:
        regex - the delimiting regular expression
        limit - the result threshold, as described above
        Returns:
        the Seq of strings computed by splitting this string around matches of the given regular expression
        Throws:
        java.util.regex.PatternSyntaxException - if the regular expression's syntax is invalid
        See Also:
        Pattern
      • toLowerCase

        public CharSeq toLowerCase​(java.util.Locale locale)
        Converts all of the characters in this CharSeq to lower case using the rules of the given Locale. Case mapping is based on the Unicode Standard version specified by the Character class. Since case mappings are not always 1:1 char mappings, the resulting CharSeq may be a different length than the original CharSeq.

        Examples of lowercase mappings are in the following table:

        Lowercase mapping examples showing language code of locale, upper case, lower case, and description
        Language Code of Locale Upper Case Lower Case Description
        tr (Turkish) \u0130 \u0069 capital letter I with dot above -> small letter i
        tr (Turkish) \u0049 \u0131 capital letter I -> small letter dotless i
        (all) French Fries french fries lowercased all chars in String
        (all) capiotacapchi capthetacapupsil capsigma iotachi thetaupsilon sigma lowercased all chars in String
        Parameters:
        locale - use the case transformation rules for this locale
        Returns:
        the CharSeq, converted to lowercase.
        See Also:
        String.toLowerCase(), String.toUpperCase(), String.toUpperCase(Locale)
      • toLowerCase

        public CharSeq toLowerCase()
        Converts all of the characters in this CharSeq to lower case using the rules of the default locale. This is equivalent to calling toLowerCase(Locale.getDefault()).

        Note: This method is locale sensitive, and may produce unexpected results if used for strings that are intended to be interpreted locale independently. Examples are programming language identifiers, protocol keys, and HTML tags. For instance, "TITLE".toLowerCase() in a Turkish locale returns "t\u0131tle", where '\u0131' is the LATIN SMALL LETTER DOTLESS I character. To obtain correct results for locale insensitive strings, use toLowerCase(Locale.ROOT).

        Returns:
        the CharSeq, converted to lowercase.
        See Also:
        String.toLowerCase(Locale)
      • toUpperCase

        public CharSeq toUpperCase​(java.util.Locale locale)
        Converts all of the characters in this CharSeq to upper case using the rules of the given Locale. Case mapping is based on the Unicode Standard version specified by the Character class. Since case mappings are not always 1:1 char mappings, the resulting CharSeq may be a different length than the original CharSeq.

        Examples of locale-sensitive and 1:M case mappings are in the following table.

        Examples of locale-sensitive and 1:M case mappings. Shows Language code of locale, lower case, upper case, and description.
        Language Code of Locale Lower Case Upper Case Description
        tr (Turkish) \u0069 \u0130 small letter i -> capital letter I with dot above
        tr (Turkish) \u0131 \u0049 small letter dotless i -> capital letter I
        (all) \u00df \u0053 \u0053 small letter sharp s -> two letters: SS
        (all) Fahrvergnügen FAHRVERGNÜGEN
        Parameters:
        locale - use the case transformation rules for this locale
        Returns:
        the CharSeq, converted to uppercase.
        See Also:
        String.toUpperCase(), String.toLowerCase(), String.toLowerCase(Locale)
      • toUpperCase

        public CharSeq toUpperCase()
        Converts all of the characters in this CharSeq to upper case using the rules of the default locale. This method is equivalent to toUpperCase(Locale.getDefault()).

        Note: This method is locale sensitive, and may produce unexpected results if used for strings that are intended to be interpreted locale independently. Examples are programming language identifiers, protocol keys, and HTML tags. For instance, "title".toUpperCase() in a Turkish locale returns "T\u0130TLE", where '\u0130' is the LATIN CAPITAL LETTER I WITH DOT ABOVE character. To obtain correct results for locale insensitive strings, use toUpperCase(Locale.ROOT).

        Returns:
        the CharSeq, converted to uppercase.
        See Also:
        String.toUpperCase(Locale)
      • capitalize

        public CharSeq capitalize​(java.util.Locale locale)
        Converts the first character in this CharSeq to upper case using the rules of the given Locale. If the CharSeq is empty, it won't have any effect. Case mapping is based on the Unicode Standard version specified by the Character class. Since case mappings are not always 1:1 char mappings, the resulting CharSeq may be a different length than the original CharSeq.

        Examples of locale-sensitive and 1:M case mappings are in the following table.

        Examples of locale-sensitive and 1:M case mappings. Shows Language code of locale, lower case, upper case, and description.
        Language Code of Locale Lower Case Upper Case Description
        tr (Turkish) \u0069 \u0130 small letter i -> capital letter I with dot above
        tr (Turkish) \u0131 \u0049 small letter dotless i -> capital letter I
        (all) \u00df \u0053 \u0053 small letter sharp s -> two letters: SS
        (all) Fahrvergnügen FAHRVERGNÜGEN
        Parameters:
        locale - use the case transformation rules for this locale
        Returns:
        the CharSeq, capitalized.
      • capitalize

        public CharSeq capitalize()
        Converts the first character in this CharSeq to upper case using the rules of the default locale. If the CharSeq is empty, it won't have any effect. This method is equivalent to capitalize(Locale.getDefault()).

        Note: This method is locale sensitive, and may produce unexpected results if used for strings that are intended to be interpreted locale independently. Examples are programming language identifiers, protocol keys, and HTML tags. For instance, "title".toUpperCase() in a Turkish locale returns "T\u0130TLE", where '\u0130' is the LATIN CAPITAL LETTER I WITH DOT ABOVE character. To obtain correct results for locale insensitive strings, use toUpperCase(Locale.ROOT).

        Returns:
        the CharSeq, capitalized.
      • trim

        public CharSeq trim()
        Returns a string whose value is this string, with any leading and trailing whitespace removed.

        If this CharSeq object represents an empty character sequence, or the first and last characters of character sequence represented by this CharSeq object both have codes greater than '\u0020' (the space character), then a reference to this CharSeq object is returned.

        Otherwise, if there is no character with a code greater than '\u0020' in the string, then a CharSeq object representing an empty string is returned.

        Otherwise, let k be the index of the first character in the string whose code is greater than '\u0020', and let m be the index of the last character in the string whose code is greater than '\u0020'. A CharSeq object is returned, representing the substring of this string that begins with the character at index k and ends with the character at index m-that is, the result of this.substring(k, m + 1).

        This method may be used to trim whitespace (as defined above) from the beginning and end of a string.

        Returns:
        A string whose value is this string, with any leading and trailing white space removed, or this string if it has no leading or trailing white space.
      • toCharArray

        public char[] toCharArray()
        Converts this string to a new character array.
        Returns:
        a newly allocated character array whose length is the length of this string and whose contents are initialized to contain the character sequence represented by this string.
      • decodeByte

        public java.lang.Byte decodeByte()
        Decodes this CharSeq into a Byte by calling Byte.decode(String).

        We write

        
         Byte value = charSeq.decodeByte();
         
        instead of
        
         Byte value = Byte.decode(charSeq.mkString());
         
        Returns:
        a Byte object holding the byte value represented by this CharSeq
        Throws:
        java.lang.NumberFormatException - if this CharSeq does not contain a parsable byte.
      • decodeInteger

        public java.lang.Integer decodeInteger()
        Decodes this CharSeq into an Integer by calling Integer.decode(String).

        We write

        
         Integer value = charSeq.decodeInteger();
         
        instead of
        
         Integer value = Integer.decode(charSeq.mkString());
         
        Returns:
        an Integer object holding the int value represented by this CharSeq
        Throws:
        java.lang.NumberFormatException - if this CharSeq does not contain a parsable int.
      • decodeLong

        public java.lang.Long decodeLong()
        Decodes this CharSeq into a Long by calling Long.decode(String).

        We write

        
         Long value = charSeq.decodeLong();
         
        instead of
        
         Long value = Long.decode(charSeq.mkString());
         
        Returns:
        a Long object holding the long value represented by this CharSeq
        Throws:
        java.lang.NumberFormatException - if this CharSeq does not contain a parsable long.
      • decodeShort

        public java.lang.Short decodeShort()
        Decodes this CharSeq into a Short by calling Short.decode(String).

        We write

        
         Short value = charSeq.decodeShort();
         
        instead of
        
         Short value = Short.decode(charSeq.mkString());
         
        Returns:
        a Short object holding the short value represented by this CharSeq
        Throws:
        java.lang.NumberFormatException - if this CharSeq does not contain a parsable short.
      • parseBoolean

        public boolean parseBoolean()
        Parses this CharSeq as a boolean by calling Boolean.parseBoolean(String).

        We write

        
         boolean value = charSeq.parseBoolean();
         
        instead of
        
         boolean value = Boolean.parseBoolean(charSeq.mkString());
         
        Returns:
        the boolean represented by this CharSeq
      • parseByte

        public byte parseByte()
        Parses this CharSeq as a signed decimal byte by calling Byte.parseByte(String).

        We write

        
         byte value = charSeq.parseByte();
         
        instead of
        
         byte value = Byte.parseByte(charSeq.mkString());
         
        Returns:
        the byte value represented by this CharSeq in decimal
        Throws:
        java.lang.NumberFormatException - If this CharSeq does not contain a parsable byte.
      • parseByte

        public byte parseByte​(int radix)
        Parses this CharSeq as a signed byte in the specified radix by calling Byte.parseByte(String, int).

        We write

        
         byte value = charSeq.parseByte(radix);
         
        instead of
        
         byte value = Byte.parseByte(charSeq.mkString(), radix);
         
        Parameters:
        radix - the radix to be used in interpreting this CharSeq
        Returns:
        the byte value represented by this CharSeq in the specified radix
        Throws:
        java.lang.NumberFormatException - If this CharSeq does not contain a parsable byte.
      • parseDouble

        public double parseDouble()
        Parses this CharSeq as a double by calling Double.parseDouble(String).

        We write

        
         double value = charSeq.parseDouble();
         
        instead of
        
         double value = Double.parseDouble(charSeq.mkString());
         
        Returns:
        the double value represented by this CharSeq
        Throws:
        java.lang.NumberFormatException - If this CharSeq does not contain a parsable double.
      • parseFloat

        public float parseFloat()
        Parses this CharSeq as a float by calling Float.parseFloat(String).

        We write

        
         float value = charSeq.parseFloat();
         
        instead of
        
         float value = Double.parseFloat(charSeq.mkString());
         
        Returns:
        the float value represented by this CharSeq
        Throws:
        java.lang.NumberFormatException - If this CharSeq does not contain a parsable float.
      • parseInt

        public int parseInt()
        Parses this CharSeq as a signed decimal int by calling Integer.parseInt(String).

        We write

        
         int value = charSeq.parseInt();
         
        instead of
        
         int value = Integer.parseInt(charSeq.mkString());
         
        Returns:
        the int value represented by this CharSeq in decimal
        Throws:
        java.lang.NumberFormatException - If this CharSeq does not contain a parsable int.
      • parseInt

        public int parseInt​(int radix)
        Parses this CharSeq as a signed int in the specified radix by calling Integer.parseInt(String, int).

        We write

        
         int value = charSeq.parseInt(radix);
         
        instead of
        
         int value = Integer.parseInt(charSeq.mkString(), radix);
         
        Parameters:
        radix - the radix to be used in interpreting this CharSeq
        Returns:
        the int value represented by this CharSeq in the specified radix
        Throws:
        java.lang.NumberFormatException - If this CharSeq does not contain a parsable int.
      • parseUnsignedInt

        @GwtIncompatible
        public int parseUnsignedInt()
        Parses this CharSeq as a unsigned decimal int by calling Integer.parseUnsignedInt(String).

        We write

        
         int value = charSeq.parseUnsignedInt();
         
        instead of
        
         int value = Integer.parseUnsignedInt(charSeq.mkString());
         
        Returns:
        the unsigned int value represented by this CharSeq in decimal
        Throws:
        java.lang.NumberFormatException - If this CharSeq does not contain a parsable unsigned int.
      • parseUnsignedInt

        @GwtIncompatible
        public int parseUnsignedInt​(int radix)
        Parses this CharSeq as a unsigned int in the specified radix by calling Integer.parseUnsignedInt(String, int).

        We write

        
         int value = charSeq.parseUnsignedInt(radix);
         
        instead of
        
         int value = Integer.parseUnsignedInt(charSeq.mkString(), radix);
         
        Parameters:
        radix - the radix to be used in interpreting this CharSeq
        Returns:
        the unsigned int value represented by this CharSeq in the specified radix
        Throws:
        java.lang.NumberFormatException - If this CharSeq does not contain a parsable unsigned int.
      • parseLong

        public long parseLong()
        Parses this CharSeq as a signed decimal long by calling Long.parseLong(String).

        We write

        
         long value = charSeq.parseLong();
         
        instead of
        
         long value = Long.parseLong(charSeq.mkString());
         
        Returns:
        the long value represented by this CharSeq in decimal
        Throws:
        java.lang.NumberFormatException - If this CharSeq does not contain a parsable long.
      • parseLong

        public long parseLong​(int radix)
        Parses this CharSeq as a signed long in the specified radix by calling Long.parseLong(String, int).

        We write

        
         long value = charSeq.parseLong(radix);
         
        instead of
        
         long value = Long.parseLong(charSeq.mkString(), radix);
         
        Parameters:
        radix - the radix to be used in interpreting this CharSeq
        Returns:
        the long value represented by this CharSeq in the specified radix
        Throws:
        java.lang.NumberFormatException - If this CharSeq does not contain a parsable long.
      • parseUnsignedLong

        @GwtIncompatible
        public long parseUnsignedLong()
        Parses this CharSeq as a unsigned decimal long by calling Long.parseUnsignedLong(String).

        We write

        
         long value = charSeq.parseUnsignedLong();
         
        instead of
        
         long value = Long.parseUnsignedLong(charSeq.mkString());
         
        Returns:
        the unsigned long value represented by this CharSeq in decimal
        Throws:
        java.lang.NumberFormatException - If this CharSeq does not contain a parsable unsigned long.
      • parseUnsignedLong

        @GwtIncompatible
        public long parseUnsignedLong​(int radix)
        Parses this CharSeq as a unsigned long in the specified radix by calling Long.parseUnsignedLong(String, int).

        We write

        
         long value = charSeq.parseUnsignedLong(radix);
         
        instead of
        
         long value = Long.parseUnsignedLong(charSeq.mkString(), radix);
         
        Parameters:
        radix - the radix to be used in interpreting this CharSeq
        Returns:
        the unsigned long value represented by this CharSeq in the specified radix
        Throws:
        java.lang.NumberFormatException - If this CharSeq does not contain a parsable unsigned long.
      • parseShort

        public short parseShort()
        Parses this CharSeq as a signed decimal short by calling Short.parseShort(String).

        We write

        
         short value = charSeq.parseShort();
         
        instead of
        
         short value = Short.parseShort(charSeq.mkString());
         
        Returns:
        the short value represented by this CharSeq in decimal
        Throws:
        java.lang.NumberFormatException - If this CharSeq does not contain a parsable short.
      • parseShort

        public short parseShort​(int radix)
        Parses this CharSeq as a signed short in the specified radix by calling Short.parseShort(String, int).

        We write

        
         short value = charSeq.parseShort(radix);
         
        instead of
        
         short value = Short.parseShort(charSeq.mkString(), radix);
         
        Parameters:
        radix - the radix to be used in interpreting this CharSeq
        Returns:
        the short value represented by this CharSeq in the specified radix
        Throws:
        java.lang.NumberFormatException - If this CharSeq does not contain a parsable short.
      • toBoolean

        public java.lang.Boolean toBoolean()
        Converts this CharSeq to a Boolean by calling Boolean.valueOf(String).

        We write

        
         Boolean value = charSeq.toBoolean();
         
        instead of
        
         Boolean value = Boolean.valueOf(charSeq.mkString());
         
        Returns:
        the Boolean value represented by this CharSeq
      • toByte

        public java.lang.Byte toByte()
        Converts this CharSeq to a Byte by calling Byte.valueOf(String).

        We write

        
         Byte value = charSeq.toByte();
         
        instead of
        
         Byte value = Byte.valueOf(charSeq.mkString());
         
        Returns:
        a Byte object holding the value represented by this CharSeq
        Throws:
        java.lang.NumberFormatException - If this CharSeq does not contain a parsable byte.
      • toByte

        public java.lang.Byte toByte​(int radix)
        Converts this CharSeq to a Byte in the specified radix by calling Byte.valueOf(String, int).

        We write

        
         Byte value = charSeq.toByte(radix);
         
        instead of
        
         Byte value = Byte.valueOf(charSeq.mkString(), radix);
         
        Parameters:
        radix - the radix to be used in interpreting this char sequence
        Returns:
        a Byte object holding the value represented by this CharSeq
        Throws:
        java.lang.NumberFormatException - If this CharSeq does not contain a parsable byte.
      • toDouble

        public java.lang.Double toDouble()
        Converts this CharSeq to a Double by calling Double.valueOf(String).

        We write

        
         Double value = charSeq.toDouble();
         
        instead of
        
         Double value = Double.valueOf(charSeq.mkString());
         
        Returns:
        a Double object holding the value represented by this CharSeq
        Throws:
        java.lang.NumberFormatException - If this CharSeq does not contain a parsable double.
      • toFloat

        public java.lang.Float toFloat()
        Converts this CharSeq to a Float by calling Float.valueOf(String).

        We write

        
         Float value = charSeq.toFloat();
         
        instead of
        
         Float value = Float.valueOf(charSeq.mkString());
         
        Returns:
        a Float object holding the value represented by this CharSeq
        Throws:
        java.lang.NumberFormatException - If this CharSeq does not contain a parsable float.
      • toInteger

        public java.lang.Integer toInteger()
        Converts this CharSeq to an Integer by calling Integer.valueOf(String).

        We write

        
         Integer value = charSeq.toInteger();
         
        instead of
        
         Integer value = Integer.valueOf(charSeq.mkString());
         
        Returns:
        an Integer object holding the value represented by this CharSeq
        Throws:
        java.lang.NumberFormatException - If this CharSeq does not contain a parsable int.
      • toInteger

        public java.lang.Integer toInteger​(int radix)
        Converts this CharSeq to an Integer in the specified radix by calling Integer.valueOf(String, int).

        We write

        
         Integer value = charSeq.toInteger(radix);
         
        instead of
        
         Integer value = Integer.valueOf(charSeq.mkString(), radix);
         
        Parameters:
        radix - the radix to be used in interpreting this char sequence
        Returns:
        an Integer object holding the value represented by this CharSeq
        Throws:
        java.lang.NumberFormatException - If this CharSeq does not contain a parsable int.
      • toLong

        public java.lang.Long toLong()
        Converts this CharSeq to a Long by calling Long.valueOf(String).

        We write

        
         Long value = charSeq.toLong();
         
        instead of
        
         Long value = Long.valueOf(charSeq.mkString());
         
        Returns:
        a Long object holding the value represented by this CharSeq
        Throws:
        java.lang.NumberFormatException - If this CharSeq does not contain a parsable long.
      • toLong

        public java.lang.Long toLong​(int radix)
        Converts this CharSeq to a Long in the specified radix by calling Long.valueOf(String, int).

        We write

        
         Long value = charSeq.toLong(radix);
         
        instead of
        
         Long value = Long.valueOf(charSeq.mkString(), radix);
         
        Parameters:
        radix - the radix to be used in interpreting this char sequence
        Returns:
        a Long object holding the value represented by this CharSeq
        Throws:
        java.lang.NumberFormatException - If this CharSeq does not contain a parsable long.
      • toShort

        public java.lang.Short toShort()
        Converts this CharSeq to a Short by calling Short.valueOf(String).

        We write

        
         Short value = charSeq.toShort();
         
        instead of
        
         Short value = Short.valueOf(charSeq.mkString());
         
        Returns:
        a Short object holding the value represented by this CharSeq
        Throws:
        java.lang.NumberFormatException - If this CharSeq does not contain a parsable short.
      • toShort

        public java.lang.Short toShort​(int radix)
        Converts this CharSeq to a Short in the specified radix by calling Short.valueOf(String, int).

        We write

        
         Short value = charSeq.toShort(radix);
         
        instead of
        
         Short value = Short.valueOf(charSeq.mkString(), radix);
         
        Parameters:
        radix - the radix to be used in interpreting this char sequence
        Returns:
        a Short object holding the value represented by this CharSeq
        Throws:
        java.lang.NumberFormatException - If this CharSeq does not contain a parsable short.
      • toJavaArray

        public java.lang.Character[] toJavaArray()
        Description copied from interface: Value
        Converts this to a Java array with component type Object
        
         // = [] of type Object[]
         Future.<String> of(() -> { throw new Error(); })
               .toJavaArray()
        
         // = [ok] of type Object[]
         Try.of(() -> "ok")
            .toJavaArray()
        
         // = [1, 2, 3] of type Object[]
         List.of(1, 2, 3)
             .toJavaArray()
         
        Specified by:
        toJavaArray in interface Value<java.lang.Character>
        Returns:
        A new Java array.