Menu
Menu
DaniWeb
Log In
Sign Up
Read
Contribute
Meet
Search
Search
About 322 results for
treeset
- Page 1
Re: TreeSet behavior
Programming
Software Development
13 Years Ago
by solomon_13000
….add("b"); t1.add("7"); //t2 = (
TreeSet
)t1.subSet("5", "c"); try{ t1…;7"); System.out.println("T-2"); t2 = (
TreeSet
)t1.subSet("5", "c"); System.out…
TreeSet behavior
Programming
Software Development
13 Years Ago
by solomon_13000
… main(String[] args){
TreeSet
<String> t1 = new
TreeSet
<String>();
TreeSet
<String> t2 = new
TreeSet
<String>(); t1….add("b"); t1.add("7"); t2 = (
TreeSet
)t1.subSet("5", "c"); try{ t1…
TreeSet - non-static variable friends cannot be referenced from a static context
Programming
Software Development
14 Years Ago
by ttboy04
…error msg when I complie this program. If I create
TreeSet
inside the Names method body there is no errors when…someone be kind enough to help me out here. Creating
TreeSet
must remain as private instance variable. Thanks in advance and… class Test { private Set<String> friends = new
TreeSet
<String>(); //if I bring this in the body…
TreeSet, internal implementation
Programming
Software Development
18 Years Ago
by Phaelax
Does anyone know how the compareTo() in
TreeSet
is implemented? I needed a sorted list of String elements and was going to use a binary chop method to find if a search key was in the list. Is this how the
TreeSet
does it already? Reason I'm asking is because speed is very important in this case.
TreeSet always finds duplicate
Programming
Software Development
14 Years Ago
by ceyesuma
Hello all. I have the
TreeSet
Component that won't add any thing uising the add …
Treeset recursion methods question
Programming
Software Development
12 Years Ago
by Syrne
… given the task to finish writing the definitions of the
Treeset
class methods. I'm currently at the [B]headSet[/B…
Java TreeSet Assistance
Programming
Software Development
15 Years Ago
by destined2bbless
…; import java.util.Scanner; import java.util.
TreeSet
; import java.util.Set; public class ProcessPublisher …()); } { Set<String> set = new
TreeSet
<String>(); //publisherList.add(publisherRecord.getPublisherName()); //StringBuffer …
Re: Java TreeSet Assistance
Programming
Software Development
15 Years Ago
by ~s.o.s~
…I'm very new to Java Steps: [LIST] [*]Declare a
TreeSet
<String> instance variable for your class [*]Read the… [*]Write a separate method to print the contents of the
TreeSet
as desired [/LIST] > 5 1/2 weeks not…than enough IMO given that reading the documentation of the
TreeSet
class and absorbing the examples doesn't take more …
Re: Java TreeSet Assistance
Programming
Software Development
15 Years Ago
by ~s.o.s~
> Using the
TreeSet
class, how do I accomplish this It's pretty simple; … last entry i.e. the publisher name to a [icode]
TreeSet
<String>[/icode]. So you'd probably have a… which returns the list of all publisher names in the
TreeSet
. Of course, to make it more *OO*, you need to…
How to store BufferedReader data in a TreeSet?
Programming
Software Development
12 Years Ago
by sarah.mathieson.7
… any duplicate lines. I think that using a
TreeSet
would be my best option. Unfortunately I don'… to get my input from the BufferedReader into the
TreeSet
. This is what I have tried: public static…throws IOException { SortedSet<String> ts = new
TreeSet
<String>(); //make arrayList of bufferedReader Strings, add…
method header for TreeSet
Programming
Software Development
14 Years Ago
by ttboy04
… answer. Thanks. [CODE]public class Food { private
TreeSet
<String> myList = new
TreeSet
<String>(); public Food() { super(); myList… = new
TreeSet
<String>(); } public String shoppingList(…
Re: How to store BufferedReader data in a TreeSet?
Programming
Software Development
12 Years Ago
by NormR1
> how to get my input from the BufferedReader Look at the BufferedReader class for a method that will return a String when a line is read from the file. Then you can add that String to the
TreeSet
Re: How to store BufferedReader data in a TreeSet?
Programming
Software Development
12 Years Ago
by sarah.mathieson.7
I'm pretty sure I want the method readLine(). To add this line to the
TreeSet
does ts.add(r.readline()) work? Or does this statement not make any sense? Or should it be in several statements?
Best Practice for Iterating and Changing Objects in TreeSet
Programming
Software Development
12 Years Ago
by freedomflyer
Hello everyone. I have a
TreeSet
<State> that I want to iterator over in …order to change the States within the
TreeSet
(more specifically, a private subclass within each state). However, I…
Re: TreeSet behavior
Programming
Software Development
13 Years Ago
by JamesCherrill
Try printing the exception - it's message will help. ps: subSet gives a "live" view, not a copy
Re: TreeSet behavior
Programming
Software Development
13 Years Ago
by JamesCherrill
I don't think you read my post properly. 1. Java kindly throws you an Exception which contains a message explaining what and why. You should ALWAYS print the Exception in your catch blocks so you can see that information. It WILL help. 2. I drew your attention to the way that subset works because that's important to understanding this result. I …
Re: TreeSet - non-static variable friends cannot be referenced from a static context
Programming
Software Development
14 Years Ago
by NormR1
The friends variable only exists when there is an instance of the Test class created using new. The Names() method exists outside of any instance of the Test class. Either create an instance of the Test class and use object.variable syntax to access the variable Or remove static from Names() definition Or make friends static. [QUOTE] how I want …
Re: TreeSet - non-static variable friends cannot be referenced from a static context
Programming
Software Development
14 Years Ago
by ttboy04
thanks NormR1 - solved
Re: TreeSet always finds duplicate
Programming
Software Development
14 Years Ago
by AbhikGhosh
have you instantiated the Set? if not it will not allow to add.
Re: TreeSet always finds duplicate
Programming
Software Development
14 Years Ago
by ceyesuma
[QUOTE=AbhikGhosh;1107917]have you instantiated the Set? if not it will not allow to add.[/QUOTE] Instantiated the set and it works. I am creating tabbed panels from the set. If I close and re run the program how do I have that list to use?
Re: TreeSet always finds duplicate
Programming
Software Development
14 Years Ago
by AbhikGhosh
You can put elements into the set and then Serialize it.That way your instance of the set will be saved. You can de-serialize it later and retrieve the instance.
Re: TreeSet always finds duplicate
Programming
Software Development
14 Years Ago
by ceyesuma
[QUOTE=AbhikGhosh;1108629]You can put elements into the set and then Serialize it.That way your instance of the set will be saved. You can de-serialize it later and retrieve the instance.[/QUOTE] thanks I will have to look that up. I just learned how to write a file. I thought writing a file would save the set. Do you know how to put a …
Re: TreeSet always finds duplicate
Programming
Software Development
14 Years Ago
by AbhikGhosh
Well you may try this: [code] File file = new File("testFile.txt"); try { //create the file file.createNewFile(); //write into file //read from the file } catch(Exception e) { e.printStackTrace(); } [/code]
Re: TreeSet always finds duplicate
Programming
Software Development
14 Years Ago
by AbhikGhosh
What do you want to find duplicates in?
Re: TreeSet always finds duplicate
Programming
Software Development
14 Years Ago
by ceyesuma
I am going to explore the set serialization to save strings to load in tabs and see if it is good. But, on creating a file. I will also need to be able to create a file that (r,w) and name it a specific name and put it in a specific dir. Is all this possible?
Re: TreeSet always finds duplicate
Programming
Software Development
14 Years Ago
by AbhikGhosh
Well I have written a code that creates a file,writes into it and reads from it. Hope this helps you. [CODE] import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; public class…
Re: TreeSet always finds duplicate
Programming
Software Development
14 Years Ago
by ceyesuma
[QUOTE=AbhikGhosh;1109128]Well I have written a code that creates a file,writes into it and reads from it. Hope this helps you. [CODE] import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.io.InputStreamReader; import …
Re: TreeSet always finds duplicate
Programming
Software Development
14 Years Ago
by AbhikGhosh
[QUOTE=ceyesuma;1109197] I have to find out how to serialize tab names [/QUOTE] I am not sure exactly what you mean by this.And what functionality do want in classes?
Re: TreeSet always finds duplicate
Programming
Software Development
14 Years Ago
by AbhikGhosh
hi ceyesuma if it helped you why dont u mark it as solved?
Re: Treeset recursion methods question
Programming
Software Development
12 Years Ago
by JamesCherrill
I can't explain the logic, but the public method is the one that gets called initially (that's why it's public), and the private method is the "helper" (being private it can only be called from within the class). There's no reason why a recursive method can't be void. Recursive just means that the method calls itself. Two method …
1
2
3
6
Next
Last
Search
Search
Forum Categories
Hardware/Software
Recommended Topics
Programming
Recommended Topics
Digital Media
Recommended Topics
Community Center
Recommended Topics
Latest Content
Newest Topics
Latest Topics
Latest Posts
Latest Comments
Top Tags
Topics Feed
Social
Forums
Top Members
Meet People
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