incubator-flex-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Omar Gonzalez <omarg.develo...@gmail.com>
Subject Re: [IDEAS] Collections and Generics
Date Fri, 24 Feb 2012 19:07:33 GMT
>
>
> Actually, I was more simply asking about if you have a property or method
> or
> parameter of type VectorCollection.<Object>.  I thought you couldn't pass
> in
> a VectorCollection of ints or a VectorCollection of strings into a
> VectorCollection of Objects.  It was a problem for straight up Vector.  You
> might say that List's selectedItems returns a Vector.<Object> but then it
> can't return a Vector.<String>
>

That's correct, I also tried using Vector.<*>, but that was also a no go.
If you look at VectorList [1], it accepts a parameter source:Object as that
was the only way I could accept a Vector of any type. I should really add
some reflection code here to at least make sure the object being injected
in the constructor is actually a Vector. Besides that there really isn't
any need to strong type it to Vector.<*> or Vector.<Object> since the rest
of the code is not reliant on any method calls specific to the class.


>
> Also, what does getItemAt return?  Does it cause type-coercion?
>

getItemAt() is identical to ArrayList and returns an Object type so its
compatible with any type of Vector declaration.


> --
> Alex Harui
> Flex SDK Team
> Adobe Systems, Inc.
> http://blogs.adobe.com/aharui
>
>
[1]
https://github.com/s9tpepper/VectorTools/blob/master/src/almerblank/flex/utils/vector/VectorList.as

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message