tagged [set]

Get distinct list between two lists in C#

Get distinct list between two lists in C# I have two lists of strings. How do I get the list of distinct values between them or remove the second list elements from the first list? The result should b...

check if a number already exist in a list in python

check if a number already exist in a list in python I am writing a python program where I will be appending numbers into a list, but I don't want the numbers in the list to repeat. So how do I check i...

22 Dec at 13:11

Convert set to string and vice versa

Convert set to string and vice versa Set to string. Obvious: String to set? Maybe like this? Extremely ugly. Is there better way to serialize/deserialize sets?

4 Dec at 17:23

Custom intersect in lambda

Custom intersect in lambda I would like to know if this is possible to solve using a lambda expression:

How to set a Javascript object values dynamically?

How to set a Javascript object values dynamically? It's difficult to explain the case by words, let me give an example: How can I set a variable property with variable value in a JavaScript object?

12 Apr at 02:48

Getting the difference between two sets

Getting the difference between two sets So if I have two sets: Is there a way to compare them and only have a set of 4 and 5 returned?

6 Sep at 17:52

Quickest way to find the complement of two collections in C#

Quickest way to find the complement of two collections in C# I have two collections of type `ICollection` called `c1` and `c2`. I'd like to find the set of items that are in `c2` that are not in `c1`,...

How to set background color of a View

How to set background color of a View I'm trying to set the background color of a View (in this case a Button). I use this code: It causes the Button to disappear from the screen. What am I doing wro...

28 May at 19:37

Best way to convert list to comma separated string in java

Best way to convert list to comma separated string in java I have `Set result` & would like to convert it to comma separated string. My approach would be as shown below, but looking for other opinion ...

4 Apr at 15:44

Convert Set to List without creating new List

Convert Set to List without creating new List I am using this code to convert a `Set` to a `List`: I want to avoid creati

8 May at 12:48

Use curly braces to initialize a Set in Python

Use curly braces to initialize a Set in Python I'm learning python, and I have a novice question about initializing sets. Through testing, I've discovered that a set can be initialized like so: Are th...

9 Jan at 22:14

How to join two sets in one line without using "|"

How to join two sets in one line without using "|" Assume that `S` and `T` are assigned sets. Without using the join operator `|`, how can I find the union of the two sets? This, for example, finds th...

2 Jul at 15:16

How to convert a set to a list in python?

How to convert a set to a list in python? I am trying to convert a set to a list in Python 2.6. I'm using this syntax: However, I get the following stack trace: How can I fix this?

9 Jan at 22:14

How do I iterate and modify Java Sets?

How do I iterate and modify Java Sets? Let's say I have a Set of Integers, and I want to increment every Integer in the Set. How would I do this? Am I allowed to add and remove elements from the set w...

12 Sep at 20:16

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

How to retrieve an element from a set without removing it? Suppose the following: How do I get a value (any value) out of `s` without doing `s.pop()`? I want to leave the item in the set until I am su...

19 Feb at 22:22

Any implementation of Ordered Set in Java?

Any implementation of Ordered Set in Java? If anybody is familiar with Objective-C there is a collection called [NSOrderedSet](https://developer.apple.com/library/ios/documentation/Foundation/Referenc...

24 Jan at 20:7

Determine the relative complement of two IEnumerable<T> sets in .NET

Determine the relative complement of two IEnumerable sets in .NET Is there an easy way to get the [relative complement](http://en.wikipedia.org/wiki/Complement_(set_theory)) of two sets? Perhaps using...

2 Jun at 19:11

How to perform set subtraction on arrays in C#?

How to perform set subtraction on arrays in C#? What's the simplest way to perform a set subtraction given two arrays in C#? Apparently this is [dead easy](http://www.java2s.com/Code/Ruby/Array/ArrayS...

21 Feb at 00:2

How can I add items to an empty set in python

How can I add items to an empty set in python I have the following procedure: But I am getting the following error: ``` Traceback (most recent call last): File "", line 3, in TypeError: cann

23 Oct at 02:45

Why Automatically implemented properties must define both get and set accessors

Why Automatically implemented properties must define both get and set accessors When we define a property like dot net can make our properties code. but when we use we face with ``` 'Hajloo.SomeThing....

24 Apr at 21:16

Redis ServiceStack - Easy getting and setting of a group of values?

Redis ServiceStack - Easy getting and setting of a group of values? I'm storing dateTime info for devices based on a unique identifier: I'm storing other info like IP Address: Now I want to get a set ...

17 Oct at 01:6

Servicestack redis client: setting a key with timespan expiration fails using

Servicestack redis client: setting a key with timespan expiration fails using The following sample fails when setting a key with timespan expiration. When setting the expiration as a datetime, it pass...

17 Aug at 12:21

random.choice from set? python

random.choice from set? python I'm working on an AI portion of a guessing game. I want the AI to select a random letter from this list. I'm doing it as a set so I can easily remove letters from the li...

29 Mar at 07:56

How to join entries in a set into one string?

How to join entries in a set into one string? Basically, I am trying to join together the entries in a set in order to output one string. I am trying to use syntax similar to the join function for lis...

30 Jan at 13:27

Converting a list to a set changes element order

Converting a list to a set changes element order Recently I noticed that when I am converting a `list` to `set` the order of elements is changed and is sorted by character. Consider this example: My q...

17 May at 03:37