Re: [DISCUSSION] Views of immutable objects.

2007-07-30 Thread Ralf Ullrich
Paulo Levi wrote: What about adding a method to String complementing the call toCharArray(), only it takes 3 arguments: An char array, a position and a length, that inside uses System.arrayCopy. Isn't that exactly what String#getChars(0, length, charArray, dstpos) does? (see also http://

Re: [DISCUSSION] Views of immutable objects.

2007-07-30 Thread Paulo Levi
What about adding a method to String complementing the call toCharArray(), only it takes 3 arguments: An char array, a position and a length, that inside uses System.arrayCopy. This would create the possibility to eliminate news when we just want to copy Strings, and still preserve immutability

Re: [DISCUSSION] LinkedHashMap iteration order.

2007-07-30 Thread Paulo Levi
Well. I've solved it independently hacking a hashmap that also maintains its access order in a LinkedList in the get, put and remove calls. A pity about the remove being o(n) but i couldn't find a way to iterate over the LinkedHashSet in reverse order (which was kinda the point anyway, since Linked