Top "Treeset" questions

a Java set implementation sorting its items upon insertion; provided by JRE/JDK.

How to print objects from a TreeSet

I want to print the instance variables of the objects I stored in my TreeSet. So given an Object with …

java iterator treeset
Adding null to empty TreeSet raising NullPointerException

import java.util.TreeSet; class Test { public static void main(String[] args) { TreeSet t=new TreeSet(); t.add(null); System.…

java nullpointerexception treeset
java TreeSet - don't remove duplicate items

TreeSet removes different items with the same Comprator value. I don't want it be removed. Is there any way to …

java comparator treeset
Java - TreeSet and hashCode()

I have a quick question about TreeSet collections and hashCode methods. I have a TreeSet and I'm adding objects to …

java hashcode treeset
When do you know when to use a TreeSet or LinkedList?

What are the advantages of each structure? In my program I will be performing these steps and I was wondering …

java linked-list treeset
TreeSet Custom Comparator Algo .. String Comparision

From the input string provided: { "200,400,7,1", "100,0,1,1", "200,200,3,1", "0,400,11,1", "407,308,5,1","100,600,9,1" } , I am adding the same in a TreeSet and want it to be sorted with …

java comparator treeset
Remove duplicate objects from a ArrayList in Android

I know this has be discussed over and over again here, but none of the examples I've tried worked for …

java android arraylist hashcode treeset
Equals and Comparable with Sets

I posted some code here which correctly solved a problem the poster had. OP wanted to remove duplicates and bring …

java equals comparable compareto treeset
Why does my TreeSet not add anything beyond the first element?

I have several arrays in the form: private static String[] patientNames = { "John Lennon", "Paul McCartney", "George Harrison", "Ringo Starr" }; Then …

java set treeset
Returning an element from a TreeSet using binary search

In TreeSet there is a method called contains that returns true if an element is in the set. I assume …

java arraylist binary-search treeset