On Sat, 27 Jan 2024 21:58:05 GMT, Joshua Cao wrote:
>> src/java.base/share/classes/java/util/HashMap.java line 503:
>>
>>> 501: */
>>> 502: final void putMapEntries(Map m, boolean
>>> evict) {
>>> 503: int s = Math.max(size() + m.size(), m.size());
>>
>> If we decide this appr
On Wed, 24 Jan 2024 21:53:51 GMT, Hannes Greule wrote:
>...then suggest we should change the Map::size() api to return a long...
For any Map/Collection you can fetch the Spliterator and use estimateSize or
getExactSizeIfKnown as both return size as a long.
-
PR Comment: https://gi
On Wed, 17 Jan 2024 21:16:02 GMT, Joshua Cao wrote:
>> ConcurrentHashMap's copy constructor calls `putAll()` -> `tryPresize()` ->
>> `transfer()`. When coming from the copy constructor, the Map is empty, so
>> there is nothing to transfer. But `transfer()` will still copy all the empty
>> node
On Thu, 4 Jan 2024 14:21:54 GMT, Valeh Hajiyev wrote:
> why do you think the code would avoid heapify? `initFromCollection` method
> will be called regardless of the type of the collection passed, which will
> heapify the queue.
I simply mean to point out:
1. That if the given comparator and
On Sat, 30 Dec 2023 20:51:43 GMT, Chen Liang wrote:
>I think this ticket should focus on adding the new constructor as part of the
>API.
Okay. I would think the code would avoid heapify when the caller does foolish
things with this API such as:
SortedSet ss = filledSortedSet();
PriorityQueue
On Mon, 25 Dec 2023 05:52:51 GMT, jmehrens wrote:
>> Valeh Hajiyev has updated the pull request incrementally with one additional
>> commit since the last revision:
>>
>> updated the javadoc
>
> Would adding a fast path to addAll solve this issue? I asked this
On Tue, 19 Dec 2023 21:17:02 GMT, Valeh Hajiyev wrote:
>> This commit addresses the current limitation in the `PriorityQueue`
>> implementation, which lacks a constructor to efficiently create a priority
>> queue with a custom comparator and an existing collection. In order to
>> create such a
On Sat, 9 Dec 2023 12:14:35 GMT, Bernd wrote:
>> @stsypanov Yes but still it is just weird to ask any output stream if *it*
>> is trusted. I mean, it feels just unsecure to ask: "Do *you* pretend to be
>> trusted?" instead of "Do *we* trust you?". I could sleep better if this
>> method would n
On Thu, 30 Nov 2023 11:12:36 GMT, Sergey Tsypanov wrote:
>> It looks like we can skip copying of `byte[]` in
>> `BufferedInputStream.implTransferTo()` for `OutputStreams` residing in
>> `java.io`.
>>
>> See comment by @vlsi in
>> https://github.com/openjdk/jdk/pull/10525/files#diff-e19c508d1b
On Thu, 30 Nov 2023 11:12:36 GMT, Sergey Tsypanov wrote:
>> It looks like we can skip copying of `byte[]` in
>> `BufferedInputStream.implTransferTo()` for `OutputStreams` residing in
>> `java.io`.
>>
>> See comment by @vlsi in
>> https://github.com/openjdk/jdk/pull/10525/files#diff-e19c508d1b
On Fri, 1 Dec 2023 23:21:35 GMT, Brian Burkhalter wrote:
>> The case of `Channels.newOutputStream(AsynchronousByteChannel)` could be
>> handled by changing the return value of that method. For example,
>> `sun.nio.ch.Streams` could have a method `OutputStream
>> of(AsynchronousByteChannel)` ad
On Fri, 1 Dec 2023 02:48:42 GMT, Brian Burkhalter wrote:
>> The only other alternative would be to walk `((FilterOutputStream)out).out`
>> and if everything in the out chain is in the "java." package then the out
>> can be trusted.
>>
>> byte[] tmp = null;
>> for (OutputStream os = out; os !=
On Thu, 30 Nov 2023 23:27:13 GMT, Brian Burkhalter wrote:
>> Good catch: that in fact defeats the protection.
>
> Changed in 176d5165f7d8f3fa4814c9838abb5d18d9f3c338 not to trust
> `FilterOutputStream`s.
The only other alternative would be to walk `((FilterOutputStream)out).out` and
if everyth
On Wed, 29 Nov 2023 22:38:59 GMT, Markus KARG wrote:
>> src/java.base/share/classes/java/io/BufferedInputStream.java line 647:
>>
>>> 645: if (avail > 0) {
>>> 646: // trust all OutputStreams from java.io
>>> 647: if (out.getClass().getPackageName() ==
On Thu, 30 Nov 2023 00:03:21 GMT, Brian Burkhalter wrote:
> Pass `ByteArrayInputStream.buf ` directly to the `OutputStream` parameter of
> `BAIS.transferTo` only if the target stream is in the `java.io` package.
src/java.base/share/classes/java/io/ByteArrayInputStream.java line 211:
> 209:
On Mon, 10 Apr 2023 13:17:39 GMT, jmehrens wrote:
>> Tingjun Yuan has updated the pull request incrementally with one additional
>> commit since the last revision:
>>
>> use spliterator().estimateSize()
>
> src/java.base/share/classes/java/lang/Str
On Mon, 10 Apr 2023 05:46:23 GMT, Tingjun Yuan wrote:
>> In the current implementation of `String.join(CharSequence, Iterable)`, the
>> temp array `elems` is always initialized with a length of 8. It will cause
>> many array recreations when the `Iterable` contains more than 8 elements.
>> Fur
On Fri, 7 Apr 2023 08:27:18 GMT, Tingjun Yuan wrote:
> In the current implementation of `String.join(CharSequence, Iterable)`, the
> temp array `elems` is always initialized with a length of 8. It will cause
> many array recreations when the `Iterable` contains more than 8 elements.
> Furtherm
On Sun, 19 Mar 2023 14:50:41 GMT, Eirik Bjorsnos wrote:
>> ZipOutputStream currently writes directory entries using the DEFLATED
>> compression method. This does not strictly comply with the APPNOTE.TXT
>> specification and is also about 10x slower than using the STORED compression
>> method.
On Wed, 15 Mar 2023 15:10:49 GMT, Eirik Bjorsnos wrote:
>> We can do `Integer.compareUnsigned(ch, 0xFF) <= 0`
>
> We could, but benchmarks show no performance improvements over the current
> PR. I think the current code is perhaps slightly more readable.
Does non-short-circuit logical AND opera
On Fri, 28 Oct 2022 23:18:00 GMT, Stuart Marks wrote:
> I'm having difficulty imagining how SequencedCollection::replaceAll could
> work or be useful. Obviously it's on List already.
In Collections.java, it seems that the cases of AbstractSequentialList are
handled like so:
1. Call toArray
2.
On Sat, 15 Oct 2022 07:30:54 GMT, Tagir F. Valeev wrote:
> For unsorted sets like LinkedHashSet, it's unclear how to behave if
> replaceAll returns identical elements. Throw an exception? Shrink the set
> size via deduplication?
I would assume the spec for replaceAll would be borrowed from
Ma
On Wed, 12 Oct 2022 13:26:29 GMT, Tagir F. Valeev wrote:
>> Java 17 added RandomGenerator interface. However, existing method
>> Collections.shuffle accepts old java.util.Random class. While since Java 19,
>> it's possible to use Random.from(RandomGenerator) wrapper, it would be more
>> conven
23 matches
Mail list logo