The addString() method belongs to the concrete value members of the class AbstractIterator. It is defined in the class IterableOnceOps. It is utilized to append the elements of the Scala Iterator to a String Builder.
Method Definition : def addString(b: StringBuilder): StringBuilder
Return Type : It returns the String Builder to which the elements were appended.
Example #1:
// Scala program of addString() // method // Creating object object GfG { // Main method def main(args:Array[String]) { // Creating an Iterator val iter = Iterator(7, 6, 8, 1) // Applying addString method val result = iter.addString(new StringBuilder()) // Displays output println(result) } } |
chevron_right
filter_none
Output:
7681
Example #2:
// Scala program of addString() // method // Creating object object GfG { // Main method def main(args:Array[String]) { // Creating an Iterator val iter = Iterator(7.7, 6.1, 8.6, 1.1) // Applying addString method val result = iter.addString(new StringBuilder()) // Displays output println(result) } } |
chevron_right
filter_none
Output:
7.76.18.61.1
Recommended Posts:
- Scala Iterator addString() method with a separator with example
- Scala Iterator addString() method with a start, a separator and an end with example
- Scala Map addString() method with example
- Scala BitSet addString() method with example
- Scala List addString() method with example
- Scala SortedMap addString() method with example
- Scala Map addString() method with a separator with example
- Scala Map addString() method with a start, a separator and an end with example
- Scala SortedMap addString() method with a separator with example
- Scala Mutable SortedMap addString() method with example
- Scala List addString() method with a separator with example
- Scala SortedMap addString() method with a start, a separator and an end with example
- Scala Mutable SortedMap addString() method with a separator with example
- Scala List addString() method with a start, a separator and an end with example
- Scala BitSet addString(b: StringBuilder, sep: String) method with separator
- Scala BitSet addString(sb: mutable.StringBuilder, start, sep, end) method with example
- Scala Iterator map() method with example
- Scala Iterator min() method with example
- Scala Iterator sum() method with example
- Scala Iterator take() method with example
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

