Top "Set" questions

A set is a collection in which no element is repeated, which may be able to enumerate its elements according to an ordering criterion (an "ordered set") or retain no order (an "unordered set").

Convert Set to List without creating new List

I am using this code to convert a Set to a List: Map<String, List<String>> …

java performance list set
Get difference between two lists

I have two lists in Python, like these: temp1 = ['One', 'Two', 'Three', 'Four'] temp2 = ['One', 'Two'] I need to create …

python performance list set set-difference
How to Iterate over a Set/HashSet without an Iterator?

How can I iterate over a Set/HashSet without the following? Iterator iter = set.iterator(); while (iter.hasNext()) { System.out.…

java loops set hashset
How to convert an Array to a Set in Java

I would like to convert an array to a Set in Java. There are some obvious ways of doing this (…

java collections arrays set
Getting an element from a Set

Why doesn't Set provide an operation to get an element that equals another element? Set<Foo> set = ...; ... Foo …

java collections set equals
Set value of hidden field in a form using jQuery's ".val()" doesn't work

I've been trying to set the value of a hidden field in a form using jQuery, but without success. Here …

jquery set hidden-fields
How to get the first element of the List or Set?

I'd like to know if I can get the first element of a list or set. Which method to use?

java list collections set
What is the difference between Set and List?

What is the fundamental difference between the Set<E> and List<E> interfaces?

java list set
Append values to a set in Python

I have a set like this: keep = set(generic_drugs_mapping[drug] for drug in drug_input) How do I …

python set append
How to retrieve an element from a set without removing it?

Suppose the following: >>> s = set([1, 2, 3]) How do I get a value (any value) out of s without …

python set