studentset.java
来自「国外的数据结构与算法分析用书」· Java 代码 · 共 35 行
JAVA
35 行
package Sets;
import Entities.*;
import dslib.dictionary.arrayed.ArrayedPKeyedDictUos;
/** This class provides static access to the dictionary of
students which is keyed by student number. */
public class StudentSet
{
/** Provides access to the dictionary of departments. */
public static ArrayedPKeyedDictUos rep;
public static void displayNames()
{
System.out.println("Students");
System.out.println("Chris Worman, number: 934555, password: 220279");
System.out.println("Jane Smith, number: 123456, password: 654321");
System.out.println("Bob Newhart, number: 987654, password: 987654\n");
}
static //execute only once (never explicitly called though)
{
rep = new ArrayedPKeyedDictUos(10);
Student s = new Student("Chris Worman", 934555, 220279);
rep.insert(new Integer(s.studentNum()), s);
s = new Student("Jane Smith", 123456, 654321);
rep.insert(new Integer(s.studentNum()), s);
s = new Student("Bob Newheart", 987654, 456789);
rep.insert(new Integer(s.studentNum()), s);
}
}/* end of StudentSet */
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?