This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes How can i check if the input is the same as the hashmap key. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "How can i check if the input is the same as the hashmap key." Watch "How can i check if the input is the same as the hashmap key." New topic
Author

How can i check if the input is the same as the hashmap key.

Tor Ludgivsen
Greenhorn

Joined: Dec 15, 2012
Posts: 7

I have this library system where i got bookdata stored in a textfile. and person data stored in another text file.

- I need to check if String isbn = sc.next(); is the same as the hashmap-bokm key (isbn) in class Bok.
The Bok bokm hashmap is made in another class that reads the file in.
Same with the Person personm which will later read in the data typed here.
What i am trying to do is to make an if test so that if isbn is in hashmap then

bufferedWriter.write(isbn+";"+now()+";"+nr+";"+name+";");
bufferedWriter.newLine();

else errormessage and retry!



"None are more hopelessly enslaved than those who falsely believe they are free" - Johann Wolfgang von Goethe
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How can i check if the input is the same as the hashmap key.
 
Similar Threads
java code problem
Having problem when i sort out data from hashmap. Variables are mixing!
Exception in thread "main" java.util.NoSuchElementException
Castor Help with unmarshalling
Reading a list of books and users from a file