Term
Definition
Example:
meaning
something that one wishes to convey, especially by language
term
a word whose definition is in a glossary
word
a string of characters in a language, which has at least one character
definition
a sequence of words that gives meaning to a term
glossary
a list of difficult or specialized terms, with their definitions,
usually near the end of a book
This code reads the term and definition to a map with the word as the key.
Here's what ive got:
private static void addToMap(String fileName, Map<String, String> words) {
SimpleReader inFile = new SimpleReader1L(fileName);
while (!inFile.atEOS()) {
String word = inFile.nextLine();
String def = inFile.nextLine();
while (!inFile.nextLine().equals("")) {
def += inFile.nextLine();
}
words.add(word, def);
}
System.out.println(words);
}
It is currently skipping every other item and giving, this result:
{(glossary,a list of difficult or specialized terms, with their definitions,a set of strings of characters, each of which has meaning),(definition,a sequence of words that gives meaning to a term),(term,a word whose definition is in a glossary),(book,a printed or written literary work),(word,a string of characters in a language, which has at least one character),(meaning,something that one wishes to convey, especially by language)}
Any help with reading files like this would also be very helpful, thanks guys
This post has been edited by GDubz: 21 November 2012 - 06:28 AM

New Topic/Question
Reply


MultiQuote


|