groovy-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Sun <realblue...@hotmail.com>
Subject About adding `emptyArray` DGSM to arrays
Date Wed, 28 Nov 2018 04:21:32 GMT
Hi all,

        Creating empty arrays are very common in many projects(including
Apache Groovy), e.g. stringList.toArray(new String[0]). However empty array
is immutable and can be shared safely, so I recommend to add `emptyArray` 
DGSM to array class, e.g. `String[].emptyArray()` returns `new String[0]`,
and no matter how many `String[].emptyArray()` is executed, it returns the
same empty string array.

        Any thoughts?

Cheers,
Daniel.Sun



--
Sent from: http://groovy.329449.n5.nabble.com/Groovy-Dev-f372993.html

Mime
View raw message