list

Check of two list have colliding element?

Is there a way to check if one list collides with another? ex: bool hit=false; foreach(var s in list2) { if (list1.Contains(s)) { hit = true; break; } } if (!hit) { ...

Is there a collection in .NET that works as a dictionary and list at the same time?

What I want is basically a collection that's a hybrid of a dictionary and a list. I want a collection that I can add key/value pairs to (like a Dictionary), but at the same be able to retrieve the values (without the keys) in the same order I added them (like a List)? Does such a collection exists in .NET? Thanks ...

Add Different Style to list tag using jquery/javascript

Hi, Is there any ways to add different style class to all li in a ul tag using jquery/javascript/php. Consider I have a list as follows <ul><li>a</li><li>b</li><li>c</li><li>d</li><li>e</li></ul> I would like to add as follows <ul><li class='cat1'>a</li><li class='cat2'>b</li><li class='cat3'>c</li><li class='cat4'>d</li><li class='...

jQuery get first five <li>

<ul> <li>text</li> <li>text</li> <li>text</li> <li>text</li> <li>text</li> <li>text</li> <li>text</li> <li>text</li> <li>text</li> <li>text</li> <li>text</li> </ul> How to add some class only for first five <li>? ...

Given a list of words, make a subset of phrases with them

What is the best way performance wise to take a list of words and turn them into phrases in python. words = ["hey","there","stack","overflow"] print magicFunction(words) >>> ["hey","there","stack","overflow", "hey there stack","hey there", "there stack overflow","there stack", "stack overflow", "hey there stack overflow" ] Order does...

A List in alphabetical order going down not across?

I have a giant list that comes out of my database in alphabetical order. It is placed in a Div with a set width. I have each floated left and the are all next to each going from left to right and its great. BUT my client wants the order to go down not across. So it is like this: apple angry antler bone beard broken She wants: ap...

Array of arrays in Java

So I want to start and say I am new to Java programming. Here is my problem. I want to create a program that in essence cycles through an array of arrays. The arrays need to be variable lengths. My first step is I start out with array of scores. Each array is connected to a specific users. These arrays will be of differing lengths depen...

overriding list result type in java

I would like some variant of this code to compile in java. class X { List<X> getvalue(){...}; } class Y extends X { List<Y> getvalue(){...}; } Javac (1.6) returns an error because List<Y> and List<X> are not compatible. The point is that I would like the compiler to recognize that List<Y> is a compatible return type to List<...

How to get a controls id from a custom List adapter in android?

I have a custom list adapter contains a layout with controls in it. I was wondering how I can get each individual controls id? I am planning on changing the color of some textviews. private void UpdateDisplay() { // define the list which holds the information of the list List<Map<String, Object>> resourceNames = new ArrayList<...

Handling sequences through C++ class interfaces

Let's say I'm writing an interface for a class A that keeps a list of objects of type B, and I want to be able to manipulate that list through class A's interface. I could put add_B, remove_B, etc. methods to A's interface, but that's a lot of code duplication (this situation occurs in many classes in my programme), so I'd rather return...

Slide down view in adnroid

I would like to have a button in my android application trigger a slide down view of a form. I want to have a view at the top of the screen, a list at the bottom of the screen, and I want to have the slide down form view appear between the two when a button is clicked. I have no problem showing the view, but can't seem to animate it fr...

Python: Should I put my data in lists or object attributes?

I am looking for an appropriate data structure in Python for processing variably structured forms. By variably structured forms I mean that the number of form fields and the types of the form's contents are not known in advance. They are defined by the user who populates the forms with his input. What are the pros and cons of putting da...

Css list problem

How can I fix my css list problem form text displaying like this inside a div tag. # ordered lists - the list items are marked with numbers or letters To display like this when inside a div tag. # ordered lists - the list items are marked with numbers or letters. here is the html. <div> <h2>header</h2> ...

Sending a application/x-www-form-urlencoded list on html

I need to send an HTTP Post request to a RESTful service written in Java and uses Jersey. My java function that handles request is like that: @POST @Consumes("application/x-www-form-urlencoded") public Response update(@FormParam("items") List<String> items) { ... } How can a create a request on html and send it, so that they are pa...

Intersect lists on KeyValuePair key?

How do I insertsect two lists of KeyValuePairs based on their keys? I have tried: List<KeyValuePair<string, string>> listA = new List<KeyValuePair<string, string>>(); List<KeyValuePair<string, string>> listB = new List<KeyValuePair<string, string>>(); ... var result = listA.Intersect(listB); Which expectedly doesn't work. Do I need to...

Are Generic lists stored on the stack or the heap in C#?

Are Generic lists stored on the stack Or the heap? example //List of Ints List<int> myInts = new List<int>(); myInts.Add(5); myInts.Add(10); myInts.Add(20); Is myInts stored on the stack or the heap? If I add an int to the list, does boxing or unboxing occur? ...

How can I instantiate a IList<T> of nested IList<T>?

I am trying to create a list of lists but am having trouble instantiating the list. IList<IList<T>> allLists = List<List<T>>(); I am getting a compile error with this line. ...

SortedList - VS - List - VS - LinkedList

In my mind it was always there that List is basically implemented using LinkedList, while normal Array is implemented as Contiguous blocks. I always tried to use List because of it is made using Generic and also might have the power of Dynamic Memory Allocation. But I was wrong. Yesterday I saw the implementation of List using Reflector...

Vertical spacing around UL tag

One of the unintended differences between a <div> tag and a <ol> or <ul> tag is that the list tags add 20px of padding at the top and bottom of the block to whatever is specified in the style properties. In fact, using a <div><li></li><li></li></div> gives exactly the desired results. Although this workaround is apparently illegal- (qu...

Need to remove duplicates from a list of dictionaries and alter data for the remaining duplicate (python)

Consider this short python list of dictionaries (first dictionary item is a string, second item is a Widget object): raw_results = [{'src': 'tag', 'widget': <Widget: to complete a form today>}, # dupe 1a {'src': 'tag', 'widget': <Widget: a newspaper>}, # dupe 2a {'src': 'zip', 'widget': <Widget: to co...