从哈希表中获取字符串值,而不使用Android Studio中的循环

时间:2017-02-27 08:43:34

标签: java android-studio hashtable

我正在努力从我的Hashtable中获取String值。

public static Hashtable<String, String> table = new Hashtable();

public static HashMap record = new HashMap();

record.put("Key_1","Name" + "Surname" + "Student_Number");
record.put("Key_2","Name" + "Surname" + "Student_Number");
record.put("Key_3","Name" + "Surname" + "Student_Number");

table.putAll(record);

这与我在代码中使用的原理相同。由于我在Android Studio中使用GUI,因此我使用EditTexts为用户提供输入。

有没有办法只从哈希表中获取姓氏,比如Key_1? 但事情是没有使用循环。

我们有一项任务,规范是我们不允许在程序中使用任何循环。

0 个答案:

没有答案
相关问题