Class CodePointMap.StringIterator

  • Enclosing class:
    CodePointMap

    public class CodePointMap.StringIterator
    extends Object
    Iterates over code points of a string and fetches map values. This does not implement java.util.Iterator.
     void onString(CodePointMap map, CharSequence s, int start) {
         CodePointMap.StringIterator iter = map.stringIterator(s, start);
         while (iter.next()) {
             int end = iter.getIndex();  // code point from between start and end
             useValue(s, start, end, iter.getCodePoint(), iter.getValue());
             start = end;
         }
     }
     

    This class is not intended for public subclassing.

    Status:
    Stable ICU 63.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected int c
      Deprecated.
      This API is ICU internal only.
      protected CharSequence s
      Deprecated.
      This API is ICU internal only.
      protected int sIndex
      Deprecated.
      This API is ICU internal only.
      protected int value
      Deprecated.
      This API is ICU internal only.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected StringIterator​(CharSequence s, int sIndex)
      Deprecated.
      This API is ICU internal only.
    • Field Detail

      • s

        @Deprecated
        protected CharSequence s
        Deprecated.
        This API is ICU internal only.
        Status:
        Internal. This API is ICU internal only.
      • sIndex

        @Deprecated
        protected int sIndex
        Deprecated.
        This API is ICU internal only.
        Status:
        Internal. This API is ICU internal only.
      • c

        @Deprecated
        protected int c
        Deprecated.
        This API is ICU internal only.
        Status:
        Internal. This API is ICU internal only.
      • value

        @Deprecated
        protected int value
        Deprecated.
        This API is ICU internal only.
        Status:
        Internal. This API is ICU internal only.
    • Constructor Detail

      • StringIterator

        @Deprecated
        protected StringIterator​(CharSequence s,
                                 int sIndex)
        Deprecated.
        This API is ICU internal only.
        Status:
        Internal. This API is ICU internal only.
    • Method Detail

      • reset

        public void reset​(CharSequence s,
                          int sIndex)
        Resets the iterator to a new string and/or a new string index.
        Parameters:
        s - string to iterate over
        sIndex - string index where the iteration will start
        Status:
        Stable ICU 63.
      • next

        public boolean next()
        Reads the next code point, post-increments the string index, and gets a value from the map. Sets an implementation-defined error value if the code point is an unpaired surrogate.
        Returns:
        true if the string index was not yet at the end of the string; otherwise the iterator did not advance
        Status:
        Stable ICU 63.
      • previous

        public boolean previous()
        Reads the previous code point, pre-decrements the string index, and gets a value from the map. Sets an implementation-defined error value if the code point is an unpaired surrogate.
        Returns:
        true if the string index was not yet at the start of the string; otherwise the iterator did not advance
        Status:
        Stable ICU 63.
      • getIndex

        public final int getIndex()
        Returns:
        the string index
        Status:
        Stable ICU 63.
      • getCodePoint

        public final int getCodePoint()
        Returns:
        the code point
        Status:
        Stable ICU 63.
      • getValue

        public final int getValue()
        Returns:
        the map value, or an implementation-defined error value if the code point is an unpaired surrogate
        Status:
        Stable ICU 63.