Is it possible to override the equals() operator (ie. for customer classes where equality may be determined by 2 or more fields matching).
相关问题
- garbage collection best practices
- Should I wait for Flash Player 10.1 or go with Fla
- How to load flex swf from flash?
- How to load flex swf from flash?
- FlashDevelop Haxe (Flash) debugger
相关文章
- Are there any benefits when using final in AS3?
- Trace on Chrome/Browser console
- as3 ByteArray to Hex (binary hex representation)
- Is building separate .swc allow a faster loading o
- getElementById not working in Google Chrome extens
- Assigning an array of objects to a DataGrid
- Libraries for text animation in Flex / Actionscrip
- About Collision detection alghorithms in AS3
Using your own equals() method for a class doesn't solve how to check if a collection contains the desired object. In flex I've always had to write a for each and iterate over each member object to check if 2 or more fields are matching. Java allows the programmer to override hashCode() and equals() that's used automatically by collection interfaces.
if you mean overloading "==" as a synonym for equals() then you can't, as ActionScript doesn't offer operator overloading. Just write an equals() method for your class and use that...