Liste des Groupes | Revenir à co vms |
On Sun, 4 Aug 2024 21:00:35 -0400>>
Arne Vajhøj <arne@vajhoej.dk> wrote:On 8/4/2024 8:09 PM, Dan Cross wrote:In article <v8o4h8$2ut3$1@dont-email.me>,>
Arne Vajhøj <arne@vajhoej.dk> wrote:Like:>
>
public class FlexArray {
private static void dump(int[] a) {
for(int v : a) {
System.out.printf(" %d", v);
}
System.out.println();
}
public static void main(String[] args) throws Exception {
int[] a1 = { 1 };
int[] a2 = { 1, 2 };
int[] a3 = { 1, 2, 3 };
dump(a1);
dump(a2);
dump(a3);
}
}
Java arrays are more like the aforementioned slices.
I don't think so.
>
Java does not have anything like slices.
>
C# does.
I thought it was C# 7.2.C# Span is similar to slices. But C# Span and C# array are far fromPay attention that despite being designed (or at least brought to
the same.
public) in this century, C# originally lacked slices.
They were added relatively recently, in v. 8.0, and referred in c# docs
as "Indices and ranges".
Les messages affichés proviennent d'usenet.