Menu
Menu
DaniWeb
Log In
Sign Up
Read
Contribute
Meet
Search
Search
About 11 results for
facebookfriends
- Page 1
Hashmap, ArrayList and Comparator
Programming
Software Development
13 Years Ago
by NewOrder
…class: [CODE]class
Facebookfriends
{
Facebookfriends
info; String name; int age;
Facebookfriends
next; public
Facebookfriends
(String studentName,int age)…; this.age = age; } public int compareTo(
Facebookfriends
another) { return this.name.compareTo(another.name); } } …
Re: Hashmap, ArrayList and Comparator
Programming
Software Development
13 Years Ago
by NormR1
[QUOTE] it doesnt work well.[/QUOTE] Please explain what happens. For debugging: print out the String being searched for with delimiters to verify the computer is using what you expect. What is the relationship between studentName and book.studentName? [QUOTE]i have a comparator function.. in the class:[/QUOTE] Can you explain what a "…
Re: Hashmap, ArrayList and Comparator
Programming
Software Development
13 Years Ago
by NewOrder
[CODE] class Student{ String studentName; String studentSurname; String studentSubject; int daysBookBorrowed; String booksName; @Override public String toString() { return "Student [booksName=" + booksName + ", daysBookBorrowed=" + daysBookBorrowed + ", studentName=" …
Re: Hashmap, ArrayList and Comparator
Programming
Software Development
13 Years Ago
by NormR1
Did you read and understand my previous post? Let me repeat it in case you didn't read it: For debugging: print out the String being searched for with delimiters to verify the computer is using what you expect. What is the relationship between studentName and book.studentName?
Re: Hashmap, ArrayList and Comparator
Programming
Software Development
13 Years Ago
by NewOrder
[CODE] import java.io.*; import java.util.HashMap; public class StudentSearchSystem{ public static void main(String[] args){ Console console=System.console(); String studentName = null; String studentSurname = null; String studentSubject = null; int daysBookBorrowed = 0; String booksName = null;…
Re: Hashmap, ArrayList and Comparator
Programming
Software Development
13 Years Ago
by NormR1
Did you read and understand my previous post? Where is the debug code? What is the relationship between studentName and book.studentName?
Re: Hashmap, ArrayList and Comparator
Programming
Software Development
13 Years Ago
by NormR1
Did you read and understand my previous post? Where is the debug code? What is the relationship between studentName and book.studentName?
Re: Hashmap, ArrayList and Comparator
Programming
Software Development
13 Years Ago
by NewOrder
lol StudentName is th input the user types in. book.studentName... is a reference to the student class my question was concertning this line alone: [CODE]if(dic.containsKey(book.studentName)){// [/CODE] i think think that i need to re-write it in a different way.. may be add nother Arraylist<> and use its methods to extract the …
Re: Hashmap, ArrayList and Comparator
Programming
Software Development
13 Years Ago
by NormR1
Still don't see any debug code. I guess you'll keep changing the code until it works. Good luck with your project.
Re: Hashmap, ArrayList and Comparator
Programming
Software Development
13 Years Ago
by NewOrder
Norm i could debug the whole thing using eclipse. my question was,, can you search a string inside an object which holds string dic.containskey(person.name); i think i need to change [CODE] HashMap<String, Object> dic=new HashMap<String, Object>();[/CODE] i think i need to change Object to ArrayList<object>// …
Re: Hashmap, ArrayList and Comparator
Programming
Software Development
13 Years Ago
by JamesCherrill
Hello again NewOrder. It looks like you just drove Norm away again. I've had a chance to re-charge my batteries, so I'll give this a quick try. 1. Going to "ArrayList<object>" won't help. 2. Do you just want to search on the student's name? If so, this is the key in the HashMap, so you can use containsKey. The problem with …
Search
Search
Forum Categories
Hardware/Software
Programming
Digital Media
Community Center
Latest Content
Newest Topics
Latest Topics
Latest Posts
Latest Comments
Top Tags
Topics Feed
Social
Meet People
Forums
Top Members
Community Functions
DaniWeb Premium
Newsletter Archive
Markdown Syntax
Community Rules
Developer APIs
Connect API
Forum API Docs
Tools
SEO Backlink Checker
Legal
Terms of Service
Privacy Policy
FAQ
About Us
Advertise
Contact Us
© 2024 DaniWeb® LLC