Generic Arrays



Hallo dclj,

offenbar ist es nicht möglich, generische Arrays zu erzeugen. Was ich
wissen möchte, ist, ob es einen "besseren" Workaround als folgenden
gibt, oder ob der "Standard" ist:

import java.lang.reflect.Array;

class Stack<T> {
T[] array;

Stack(Class<T> clazz, int capacity) {
array = (T[]) Array.newInstance(clazz, capacity); // geht das
// besser?
}
}

Was mich noch interessieren würde, ist ob/wann Sun plant, dieses Manko
zu verbessern.

Vielen Dank - Stephan

--

Früher hieß es ja: Ich denke, also bin ich.
Heute weiß man: Es geht auch so.

- Dieter Nuhr

--

JAddressBook 2.0: http://www-public.tu-bs.de:8080/~y0027750/

--
The e-mail address in this postings from is solely
used for spam protection. If a private response to
this posting is necessary, please respond to

-> stephan [dot] friedrichs [at] tu-bs [dot] de <-
.



Relevant Pages

  • Re: Was bedeutet [[ expression ]]
    ... die Nutzung von unportablen Konstruken, ... funktionieren als dieser Workaround, zumindest ist das meine ... Siehe ISO/IEC Standard 9945 sowie IEEE Standard 1003.1-2001 aka Single ... UNIX Specification Version 3 Shell & Utilities -> test ...
    (de.comp.os.unix.shell)
  • Re: openssl 0.9.7e make fails with "Argument list too long"
    ... you can up the ridiculously low number for ARG_MAX in ... Of course there is probably some workaround possible within the port, ... and it really should build with a standard kernel - after all, ...
    (comp.unix.bsd.freebsd.misc)
  • Re: SqlDecimal inconsistencies with Decimal
    ... > We have found some rather odd behaviour in the SqlDecimal type, ... > standard Decimal type. ... > direction of a workaround or fix. ... > Sub Main ...
    (microsoft.public.dotnet.framework)
  • Re: Multithread select() bug
    ... but only as a workaround (and not a universally ... > completely misunderstood the various references). ... that fits the standard description. ... send the line "unsubscribe linux-kernel" in ...
    (Linux-Kernel)
  • Re: Frage zum Verhalten als Reiter bei einem Fall von Druse im Stall
    ... etc. sollte in so einem Fall Standard sein. ... Keine Hysterie erzeugen, ... aber einfach die Vorsicht walten lassen.... ...
    (de.rec.tiere.pferde)

Loading