| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 /** | 5 /** |
| 6 * The StringBuffer class is useful for concatenating strings | 6 * The StringBuffer class is useful for concatenating strings |
| 7 * efficiently. Only on a call to [toString] are the strings | 7 * efficiently. Only on a call to [toString] are the strings |
| 8 * concatenated to a single String. | 8 * concatenated to a single String. |
| 9 */ | 9 */ |
| 10 class StringBufferImpl implements StringBuffer { | 10 class StringBufferImpl implements StringBuffer { |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 return this; | 36 return this; |
| 37 } | 37 } |
| 38 _buffer.add(str); | 38 _buffer.add(str); |
| 39 _length += str.length; | 39 _length += str.length; |
| 40 return this; | 40 return this; |
| 41 } | 41 } |
| 42 | 42 |
| 43 /** | 43 /** |
| 44 * Adds all items in [objects] to the buffer. Returns [this]. | 44 * Adds all items in [objects] to the buffer. Returns [this]. |
| 45 */ | 45 */ |
| 46 StringBuffer addAll(Collection<Object> objects) { | 46 StringBuffer addAll(Collection objects) { |
| 47 for (Object obj in objects) { | 47 for (Object obj in objects) { |
| 48 add(obj); | 48 add(obj); |
| 49 } | 49 } |
| 50 return this; | 50 return this; |
| 51 } | 51 } |
| 52 | 52 |
| 53 /** | 53 /** |
| 54 * Adds the string representation of [charCode] to the buffer. | 54 * Adds the string representation of [charCode] to the buffer. |
| 55 * Returns [this]. | 55 * Returns [this]. |
| 56 */ | 56 */ |
| (...skipping 20 matching lines...) Expand all Loading... |
| 77 _buffer.clear(); | 77 _buffer.clear(); |
| 78 _buffer.add(result); | 78 _buffer.add(result); |
| 79 // Since we track the length at each add operation, there is no | 79 // Since we track the length at each add operation, there is no |
| 80 // need to update it in this function. | 80 // need to update it in this function. |
| 81 return result; | 81 return result; |
| 82 } | 82 } |
| 83 | 83 |
| 84 List<String> _buffer; | 84 List<String> _buffer; |
| 85 int _length; | 85 int _length; |
| 86 } | 86 } |
| OLD | NEW |