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.<String[]>emptyArray()


________________________________
From: Milles, Eric (TR Tech, Content & Ops)
Sent: Wednesday, November 28, 2018 9:38:29 AM
To: dev@groovy.apache.org
Subject: Re: About adding `emptyArray` DGSM to arrays


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.  One-dimensional will be 
the most common use case by far.


________________________________
From: Daniel.Sun <sun...@apache.org>
Sent: Wednesday, November 28, 2018 6:28 AM
To: d...@groovy.incubator.apache.org
Subject: Re: About adding `emptyArray` DGSM to arrays

`String.emptyArray()` may be better

Cheers,
Daniel.Sun




-----
Daniel Sun
Apache Groovy committer
Blog: 
https://urldefense.proofpoint.com/v2/url?u=http-3A__blog.sunlan.me&d=DwICAg&c=4ZIZThykDLcoWk-GVjSLmy8-1Cr1I4FWIvbLFebwKgY&r=tPJuIuL_GkTEazjQW7vvl7mNWVGXn3yJD5LGBHYYHww&m=7qbzGMIqJYoHbJpNbMib04Yqa0MBz3SmvB_HRFlzoVU&s=svUDTur2JydWqrY_bie1WA-6JNbPc5xortZfJ8mXwFw&e=
Twitter: @daniel_sun

--
Sent from: 
https://urldefense.proofpoint.com/v2/url?u=http-3A__groovy.329449.n5.nabble.com_Groovy-2DDev-2Df372993.html&d=DwICAg&c=4ZIZThykDLcoWk-GVjSLmy8-1Cr1I4FWIvbLFebwKgY&r=tPJuIuL_GkTEazjQW7vvl7mNWVGXn3yJD5LGBHYYHww&m=7qbzGMIqJYoHbJpNbMib04Yqa0MBz3SmvB_HRFlzoVU&s=U88DnA1FvITuWS-GDURFDVRsonTtWhcEymeU09TkljQ&e=

Reply via email to