Remove duplicating Points from Array


/ Published in: ActionScript 3
Save to your folder(s)

Removes duplicating elements from Array, containing only objects of Point class


Copy this code and paste it in your HTML
  1. function removeDuplicates (input:Array):Array
  2. {
  3. var unique:Array = new Array();
  4. testLoop:for (var l:uint = 0; l < input.length; l++)
  5. {
  6. for (var m:uint = 0; m < unique.length; m++)
  7. {
  8. if ((input[l] as Point).equals(unique[m]))
  9. {
  10. continue testLoop;
  11. }
  12. }
  13. unique.push(input[l]);
  14. }
  15. return unique;
  16. }

URL: unique-points-array

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.