src/share/jaxws_classes/javax/xml/bind/annotation/adapters/CollapsedStringAdapter.java

changeset 397
b99d7e355d4b
parent 286
f50545b5e2f1
child 637
9c07ef4934dd
equal deleted inserted replaced
393:6cdc6ed98780 397:b99d7e355d4b
1 /* 1 /*
2 * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this 7 * published by the Free Software Foundation. Oracle designates this
62 return text; 62 return text;
63 63
64 // we now know that the input contains spaces. 64 // we now know that the input contains spaces.
65 // let's sit down and do the collapsing normally. 65 // let's sit down and do the collapsing normally.
66 66
67 StringBuffer result = new StringBuffer(len /*allocate enough size to avoid re-allocation*/ ); 67 StringBuilder result = new StringBuilder(len /*allocate enough size to avoid re-allocation*/ );
68 68
69 if(s!=0) { 69 if(s!=0) {
70 for( int i=0; i<s; i++ ) 70 for( int i=0; i<s; i++ )
71 result.append(text.charAt(i)); 71 result.append(text.charAt(i));
72 result.append(' '); 72 result.append(' ');

mercurial