Re: Do Set implementations waste memory?

2010-03-17 Thread Dimitris Andreou
2010/3/18 Rémi Forax > Le 18/03/2010 00:59, Paulo Levi a écrit : > > My understanding is that set implementations are implemented by using Maps >> internally + a marker object, and that since Maps are implemented using >> arrays of entries this is at least n*3 references more that what is needed

Re: Do Set implementations waste memory?

2010-03-17 Thread Rémi Forax
Le 18/03/2010 00:59, Paulo Levi a écrit : My understanding is that set implementations are implemented by using Maps internally + a marker object, and that since Maps are implemented using arrays of entries this is at least n*3 references more that what is needed, since there are never multiple

Do Set implementations waste memory?

2010-03-17 Thread Paulo Levi
My understanding is that set implementations are implemented by using Maps internally + a marker object, and that since Maps are implemented using arrays of entries this is at least n*3 references more that what is needed, since there are never multiple values. Any plans to change this? I suspect

Re: 2 Questions on StringBuffer

2010-03-17 Thread Martin Buchholz
On Wed, Mar 17, 2010 at 14:24, Ulf Zibis wrote: > Am 17.03.2010 20:12, schrieb Martin Buchholz: >> >> On Wed, Mar 17, 2010 at 10:02, Ulf Zibis  wrote: >> >>> >>> Additionally I think, there's a bug in javadoc of those methods. >>> Actually they throw StringIndexOutOfBoundsException. >>> >> >> Why

Re: 2 Questions on StringBuffer

2010-03-17 Thread Ulf Zibis
Am 17.03.2010 20:12, schrieb Martin Buchholz: On Wed, Mar 17, 2010 at 10:02, Ulf Zibis wrote: Additionally I think, there's a bug in javadoc of those methods. Actually they throw StringIndexOutOfBoundsException. Why would that be a bug? I think, javadoc should indicate StringI

Re: request for paired constants in j.l.Character

2010-03-17 Thread Martin Buchholz
On Tue, Mar 16, 2010 at 17:14, Ulf Zibis wrote: > In java.lang.Character we have: >    public static final char MIN_VALUE = '\u'; >    public static final char MAX_VALUE = '\u'; >    public static final int MIN_CODE_POINT = 0x00; >    public static final int MAX_CODE_POINT = 0X10;

Re: 2 Questions on StringBuffer

2010-03-17 Thread Martin Buchholz
On Wed, Mar 17, 2010 at 10:02, Ulf Zibis wrote: > Am 17.03.2010 18:41, schrieb Martin Buchholz: >> >> On Wed, Mar 17, 2010 at 08:29, Ulf Zibis  wrote: >> >>> >>> Why there are 2 methods which do not use the super method, where I can't >>> see >>> any difference? : >>> >>>    public synchronized ch

Re: 2 Questions on StringBuffer

2010-03-17 Thread Ulf Zibis
Am 17.03.2010 18:41, schrieb Martin Buchholz: On Wed, Mar 17, 2010 at 08:29, Ulf Zibis wrote: Why there are 2 methods which do not use the super method, where I can't see any difference? : public synchronized char charAt(int index) public synchronized void setCharAt(int index, char

Re: 2 Questions on StringBuffer

2010-03-17 Thread Martin Buchholz
On Wed, Mar 17, 2010 at 08:29, Ulf Zibis wrote: > Why there are 2 methods which do not use the super method, where I can't see > any difference? : > >    public synchronized char charAt(int index) >    public synchronized void setCharAt(int index, char ch) You're correct that these methods could

Re: 2 Questions on StringBuffer

2010-03-17 Thread Ulf Zibis
Am 17.03.2010 17:36, schrieb Rémi Forax: Le 17/03/2010 17:29, Ulf Zibis a écrit : Why there are 2 methods which do not use the super method, where I can't see any difference? : public synchronized char charAt(int index) public synchronized void setCharAt(int index, char ch) Wouldn't e

Re: 2 Questions on StringBuffer

2010-03-17 Thread Rémi Forax
Le 17/03/2010 17:29, Ulf Zibis a écrit : Why there are 2 methods which do not use the super method, where I can't see any difference? : public synchronized char charAt(int index) public synchronized void setCharAt(int index, char ch) Wouldn't ensureCapacity better coded as follows? :

2 Questions on StringBuffer

2010-03-17 Thread Ulf Zibis
Why there are 2 methods which do not use the super method, where I can't see any difference? : public synchronized char charAt(int index) public synchronized void setCharAt(int index, char ch) Wouldn't ensureCapacity better coded as follows? : public void ensureCapacity(int minimumC

Re: review request for 6798511/6860431: Include functionality of Surrogate in Character

2010-03-17 Thread Xueming Shen
Martin Buchholz wrote: On Wed, Mar 17, 2010 at 01:11, Ulf Zibis wrote: Am I mad ??? 2nd. correction: But for (int i = offset; i < offset + count; i++) { int c = codePoints[i]; char plane = (char)(c >>> 16); if (plane == 0) n += 1;

Re: review request for 6798511/6860431: Include functionality of Surrogate in Character

2010-03-17 Thread Martin Buchholz
On Wed, Mar 17, 2010 at 01:11, Ulf Zibis wrote: > Am I mad ??? > > 2nd. correction: > > But >        for (int i = offset; i < offset + count; i++) { >            int c = codePoints[i]; >            char plane = (char)(c >>> 16); >            if (plane == 0) >                n += 1; >            el

Re: review request for 6798511/6860431: Include functionality of Surrogate in Character

2010-03-17 Thread Ulf Zibis
Am I mad ??? 2nd. correction: But for (int i = offset; i < offset + count; i++) { int c = codePoints[i]; char plane = (char)(c >>> 16); if (plane == 0) n += 1; else if (plane < 0x11) n += 2; else

Re: review request for 6798511/6860431: Include functionality of Surrogate in Character

2010-03-17 Thread Ulf Zibis
Oops, correction: But for (int i = offset; i < offset + count; i++) { int c = codePoints[i]; byte plane = (byte)(c >>> 16); if (plane == 0) n += 1; else if (plane <= (byte)0x11) n += 2; else throw