【发布时间】:2010-09-14 21:08:12
【问题描述】:
我需要让团队按点的顺序排序,从多到少,我必须编写一个新方法并且可以更改类标题。 我正在考虑将其用作我的方法,但它会使团队按最少到最多的顺序排列:S 所以我不知道如何解决它,我也不知道如果我需要对类标题进行哪些更改随便!
public void orderPoints()
{
List<String> points = new ArrayList<String>();
Collections.sort(points);
}
我知道我可以使用 Collections.max 和 min 但不确定如何过滤中的其余点
类的其余代码
公开课联赛 { /* 实例 变量 */
私人团队名称;
私有 int 点;/** * League 类对象的构造函数。 */ 公开联赛(球队名称)
{ 超级();name = aName; points = 0; }/** * 返回接收者的名字 Team */ 公共团队 getName() { 返回这个名称; }
/** * Returns the receiver's points */ public int getPoints() { return points; } /** * Sets the receiver's points */ public void setPoints(int aPoints) { this.points = aPoints; }
【问题讨论】:
标签: java