flex-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Josh Tynjala (Commented) (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (FLEX-36) Add Vector implementations of IList and ICollectionView
Date Thu, 12 Apr 2012 21:09:18 GMT

    [ https://issues.apache.org/jira/browse/FLEX-36?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13252833#comment-13252833

Josh Tynjala commented on FLEX-36:

I decided to do some further testing of Vector.<*>. I tried some similar code with a
variety of data types, as shown below, and only the numeric types failed. That may not change
anything, but it's worth noting, I think.

var doVector:Vector.<DisplayObject> = new <DisplayObject>[new Sprite(), new Shape(),
new MovieClip()];
trace("display objects:", doVector, doVector as Vector.<*>);
//display objects: [object Sprite],[object Shape],[object MovieClip] [object Sprite],[object
Shape],[object MovieClip]

var objectVector:Vector.<Object> = new <Object>[{}, {}, {}];
trace("objects:", objectVector, objectVector as Vector.<*>);
//objects: [object Object],[object Object],[object Object] [object Object],[object Object],[object

var boolVector:Vector.<Boolean> = new <Boolean>[true, true, false];
trace("booleans:", boolVector, boolVector as Vector.<*>);
//booleans: true,true,false true,true,false

var stringVector:Vector.<String> = new <String>["One", "Two", "Three"];
trace("strings:", stringVector, stringVector as Vector.<*>);
//strings: One,Two,Three One,Two,Three

var numberVector:Vector.<Number> = new <Number>[1, 2, 3];
trace("numbers:", numberVector, numberVector as Vector.<*>);
//numbers: 1,2,3 null

var intVector:Vector.<int> = new <int>[-1, 0, 1];
trace("ints", intVector, intVector as Vector.<*>);
//ints -1,0,1 null

var uintVector:Vector.<uint> = new <uint>[1, 2, 3];
trace("uints", uintVector, uintVector as Vector.<*>);
//uints 1,2,3 null

var xmlVector:Vector.<XML> = new <XML>[<one>one</one>, <two>two</two>,
trace("xml", xmlVector, xmlVector as Vector.<*>);
//xml one,two,three one,two,three
> Add Vector implementations of IList and ICollectionView
> -------------------------------------------------------
>                 Key: FLEX-36
>                 URL: https://issues.apache.org/jira/browse/FLEX-36
>             Project: Apache Flex
>          Issue Type: Improvement
>            Reporter: Josh Tynjala
>            Assignee: Bertrand Delacretaz
>            Priority: Minor
>              Labels: List, collections
> VectorList and VectorCollection, similar to ArrayList and ArrayCollection. Feels weird
that I need to convert Vectors to Arrays to use in Flex collections.
> In case anyone is unaware, you can cast Vector.<WhateverTypeYouWant> as Vector.<*>.
Works with the "as" and "is" keywords, as you can see below:
> var strings:Vector.<String> = new <String>["One", "Two", "Three"];
> trace(strings is Vector.<*>); //true
> var generic:Vector.<*> = strings as Vector.<*>;
> trace(strings) //One, Two, Three

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira


View raw message