English 中文(简体)
如何阅读java文稿,制定一些标准
原标题:how to read a text file in java and set up some criteria
  • 时间:2012-01-16 07:06:24
  •  标签:
  • java

我的电脑中有一份文字材料,一读即构成我的java方案,现在我想制定一些标准。

here is my Notepad File :

   #Students
   #studentId   studentkey  yearLevel   studentName token   
   358314           432731243   12          Adrian      Afg56       
   358297           432730131   12          Armstrong   YUY89       
   358341           432737489   12          Atkins      JK671   

        #Teachers
        #teacherId  teacherkey    yearLevel teacherName token   
        358314          432731243   12          Adrian      N7ACD       
        358297          432730131   12          Armstrong   EY2C        
        358341          432737489   12          Atkins      F4NGH

当我从本说明中读到时,即获得我申请中的确切数据,但现在,如果这属于上述学生或教师的象征性存在,我想检查一下用户刚刚进入我主要网页(例如有象征性的“JK671”)的症状吗?

      output should be like "the token JK671 belongs to Student "..

how could i achieve this ? thanks

最佳回答

你们通过在教师和学生上进行游说,把他们的守则与被打成像,来实现这一目标。

If the codes are unique identifiers, and your program must search by code, then you should creta e a Map<String, Teacher> and an Map<String, Student>, where the keys of the maps are the teacher/student codes, and use the map s containsKey method to know if such a teacher or student code exists. This will lean to O(1) searches rather than O(n).

问题回答

你们要么把所有东西都存放在一个 d子里,要么拥有教师和学生的班子,继承一个共同的超级阶级,在钥匙是你们的象征的地方,其价值就是教师/学生。





相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签