Advertisement
Guest User

Untitled

a guest
Mar 22nd, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const std = require("tstl");
  2.  
  3. class Point
  4. {
  5.     constructor(x = Math.random() * 100, y = Math.random() * 100, z = Math.random() * 100)
  6.     {
  7.         this.x = x;
  8.         this.y = y;
  9.     }
  10.    
  11.     less(obj)
  12.     {
  13.         if (this.x === obj.x)
  14.             return this.y < obj.y;
  15.         else
  16.             return this.x < obj.x;
  17.     }
  18. }
  19.  
  20. function main()
  21. {
  22.     let set = new std.TreeSet();
  23.     for (let i = 0; i < 10; ++i)
  24.         set.insert(new Point());
  25.        
  26.     for (let p of set)
  27.         console.log(p);
  28. }
  29. main();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement