import java.util.*;
public class Point2D
{
private double x;
private double y;
public Point2D(double x, double y)
{
this.x = x;
this.y = y;
}
private double Euclidean()
{
double Distance = Math.sqrt((x * x) + (y * y));
return Distance;
}
public String toString()
{
return "x: " + x + ", y: " + y;
}
public static class YOrder implements Comparator<Point2D>
{
public int compare(Point2D self, Point2D other)
{
if (self.y > other.y)
return 1;
if (self.y < other.y)
return -1;
else
return 0;
}
}
public static void main(String[] args)
{
Stack<Point2D> stack = new Stack<Point2D>();
while (!StdIn.isEmpty())
{
double x = StdIn.readDouble();
double y = StdIn.readDouble();
stack.push(new Point2D(x,y));
}
Arrays.sort(stack);
}
}
Это для класса, и я не могу использовать Collections
или ArrayList
.