Type Safe Collections?

From: Ken (kk_oop_at_yahoo.com)
Date: 05/31/04


Date: 31 May 2004 05:45:05 -0700

It seems that java collections (other than arrays) are not type safe.
I say this since they hold items of type "object." IOW, the type
checking can't be done at compile time, and at run time it seems you
can't guarantee that a given collection will be used for a particular
data type. Is there a standard approach or pattern used to make a
collection type safe?

Thanks,

Ken



Relevant Pages

  • Re: Type Safe Collections?
    ... > It seems that java collections (other than arrays) are not type safe. ... > checking can't be done at compile time, and at run time it seems you ...
    (comp.lang.java.programmer)
  • Re: Type Safe Collections?
    ... > checking can't be done at compile time, and at run time it seems you ... > can't guarantee that a given collection will be used for a particular ... With the Sun JDK 1.5 (which is available as a beta) there are type safe ...
    (comp.lang.java.programmer)
  • Re: Type Safe Collections?
    ... > It seems that java collections (other than arrays) are not type safe. ... > checking can't be done at compile time, and at run time it seems you ...
    (comp.lang.java.programmer)
  • Re: Adding functionality to ARM BASIC
    ... rather than a BASIC string) ... the allocated memory, etc.). ... 'arrays' simulated by means of pointer arithmetic aren't ... But now you say they are type safe, ...
    (comp.sys.acorn.programmer)