[flexcoders] Re: How to copy or clone Dictionary?

2008-04-04 Thread lytvynyuk
Yes!!! Thank you, actually u helped me a lot! :)

--- In flexcoders@yahoogroups.com, Scott Melby <[EMAIL PROTECTED]> wrote:
>
> hey... i was close ;)
> 
> Scott
> 
> Scott Melby
> Founder, Fast Lane Software LLC
> http://www.fastlanesw.com
> http://blog.fastlanesw.com
> 
> 
> 
> lytvynyuk wrote:
> > Sorry friend but I think your case will not gonna work ;)
> > what is put methods? Dictionary doesn't have it :)
> >
> > But here is my corrected case, where I do object copy of entries, this
> > case will not gonna work If you entries is Dictionary or Class
> >
> >  static public function
cloneDictionary(oldDictionary:Dictionary,
> > weakKeys:Boolean = false):Dictionary
> >  {
> >  var newDictionary:Dictionary = new Dictionary(weakKeys);
> >  for(var key:Object in oldDictionary) {
> >  newDictionary[key] =
> > ObjectUtil.copy(oldDictionary[key]);
> >  }
> >  return newDictionary;
> >  }
> >
> > http://riahut.com 
> >
> > --- In flexcoders@yahoogroups.com, Scott Melby  wrote:
> >   
> >> Fixing a couple of typos :)
> >>
> >> static public funciton cloneDictionary(oldDictionary:Dictionary,
> >> 
> > weakKeys:Boolean = false):Dictionary
> >   
> >> {
> >>var newDictionary:Dictionary = new Dictionary(weakKeys);
> >>
> >>for(var key:Object in oldDictionary)
> >>{
> >>new.put(key, oldDictionary[key]);
> >>}
> >>
> >>return newDictionary;
> >> }
> >>
> >>
> >> Scott
> >>
> >> Scott Melby
> >> Founder, Fast Lane Software LLC
> >> http://www.fastlanesw.com
> >> http://blog.fastlanesw.com
> >> 
> >
> >
> >
>




Re: [flexcoders] Re: How to copy or clone Dictionary?

2008-04-04 Thread Scott Melby

hey... i was close ;)

Scott

Scott Melby
Founder, Fast Lane Software LLC
http://www.fastlanesw.com
http://blog.fastlanesw.com



lytvynyuk wrote:

Sorry friend but I think your case will not gonna work ;)
what is put methods? Dictionary doesn't have it :)

But here is my corrected case, where I do object copy of entries, this
case will not gonna work If you entries is Dictionary or Class

 static public function cloneDictionary(oldDictionary:Dictionary,
weakKeys:Boolean = false):Dictionary
 {
 var newDictionary:Dictionary = new Dictionary(weakKeys);
 for(var key:Object in oldDictionary) {
 newDictionary[key] =
ObjectUtil.copy(oldDictionary[key]);
 }
 return newDictionary;
 }

http://riahut.com 

--- In flexcoders@yahoogroups.com, Scott Melby <[EMAIL PROTECTED]> wrote:
  

Fixing a couple of typos :)

static public funciton cloneDictionary(oldDictionary:Dictionary,


weakKeys:Boolean = false):Dictionary
  

{
   var newDictionary:Dictionary = new Dictionary(weakKeys);

   for(var key:Object in oldDictionary)
   {
   new.put(key, oldDictionary[key]);
   }

   return newDictionary;
}


Scott

Scott Melby
Founder, Fast Lane Software LLC
http://www.fastlanesw.com
http://blog.fastlanesw.com




  


[flexcoders] Re: How to copy or clone Dictionary?

2008-04-04 Thread lytvynyuk
Sorry friend but I think your case will not gonna work ;)
what is put methods? Dictionary doesn't have it :)

But here is my corrected case, where I do object copy of entries, this
case will not gonna work If you entries is Dictionary or Class

 static public function cloneDictionary(oldDictionary:Dictionary,
weakKeys:Boolean = false):Dictionary
 {
 var newDictionary:Dictionary = new Dictionary(weakKeys);
 for(var key:Object in oldDictionary) {
 newDictionary[key] =
ObjectUtil.copy(oldDictionary[key]);
 }
 return newDictionary;
 }

http://riahut.com 

--- In flexcoders@yahoogroups.com, Scott Melby <[EMAIL PROTECTED]> wrote:
>
> Fixing a couple of typos :)
>
> static public funciton cloneDictionary(oldDictionary:Dictionary,
weakKeys:Boolean = false):Dictionary
> {
>var newDictionary:Dictionary = new Dictionary(weakKeys);
>
>for(var key:Object in oldDictionary)
>{
>new.put(key, oldDictionary[key]);
>}
>
>return newDictionary;
> }
>
>
> Scott
>
> Scott Melby
> Founder, Fast Lane Software LLC
> http://www.fastlanesw.com
> http://blog.fastlanesw.com