Re: About adding `emptyArray` DGSM to arrays

2018-11-28 Thread Daniel.Sun
`String.emptyArray()` may be better Cheers, Daniel.Sun - Daniel Sun Apache Groovy committer Blog: http://blog.sunlan.me Twitter: @daniel_sun -- Sent from: http://groovy.329449.n5.nabble.com/Groovy-Dev-f372993.html

Re: About adding `emptyArray` DGSM to arrays

2018-11-28 Thread Milles, Eric (TR Tech, Content & Ops)
How would you return an empty multi-dimensional array? Your original proposal would cover that, correct? String[][].emptyArray() Under your new proposal, String.emptryArray() -> String[], is this it String[].emptyArray() -> String[][]? I do prefer "String.emptryArray()" at first glance. On

Re: About adding `emptyArray` DGSM to arrays

2018-11-28 Thread Milles, Eric (TR Tech, Content & Ops)
In keeping with the design of "Collections.emptyList()", "Collections.emptySet()", etc. What about a DGSM on java.util.Arrays? Something like "Arrays.emptyArray()" which would accept generics or coercion like the Collections methods. String[] empty = Arrays.emptyArray() def empty = Arrays.e

Re: About adding `emptyArray` DGSM to arrays

2018-11-28 Thread Daniel.Sun
> String[].emptyArray() -> String[][]? true > Arrays.emptyArray() or `Arrays.emptyArray(String[])`, but they look a bit verbose... Cheers, Daniel.Sun - Daniel Sun Apache Groovy committer Blog: http://blog.sunlan.me Twitter: @daniel_sun -- Sent from: http://groovy.329449.n5.nabble.com

Re: About adding `emptyArray` DGSM to arrays

2018-11-28 Thread MG
Despite "In keeping with the design of...": Why not go Groovy here and supply this as a property ? E.g.: String[].emptyArray ? (Would imho also expresses more that the resulting object is shared...) Cheers, mg Am 28.11.2018 um 16:42 schrieb Milles, Eric (TR Tech, Content & Ops): In keepi