list

Java nested list to array conversion

What is the most efficient way to convert data from nested lists to an object array (which can be used i.e. as data for JTable)? List<List> table = new ArrayList<List>(); for (DATAROW rowData : entries) { List<String> row = new ArrayList<String>(); for (String col : rowData.getDataColumn()) row.add(col); table.add...

Is there a Java array/list which is statically typed AND variable length

This would be very handy as typecasting gets boring fast. ...

How to append the contents of a list at the end of the other list?

How do I append the contents of one list at the end of another list? ...

What is the difference between the scalar and list contexts in Perl?

What is the difference between the scalar and list contexts in Perl and does this have any parallel in other languages such as Java or Javascript? ...

Recommend ASP.NET 3.5 SP1 Hosting Providers

Would like to see a list of affordable ASP.NET 3.5 SP1 Hosting providers build up. Along with your review of the service, lacking features, special features, etc... Discount ASP.NET MochaHost At last update MochaHost does not offer SP1  they now offer SP1 CrystalTech Gearhost HostMySite please add more update: Anybody see a b...

Turn these haskell Int lists into a different one

I have the following Int lists: t1 = [1000, 1001, 1002, 1003, 1004] t2 = [2000, 2001, 2002] t3 = [3000, 3001, 3002, 3003] The lists size are variable, they are not just 3 like in this example. They can have 1 element or many more. Then I have this: tAll = [t1, t2, t3] I need a function that "turns" tAll into something like this: [...

Java: split a List into two sub-Lists?

What's the simplest, most standard, and/or most efficient way to split a List into two sub-Lists in Java? It's OK to mutate the original List, so no copying should be necessary. The method signature could be /** Split a list into two sublists. The original list will be modified to * have size i and will contain exactly the same element...

How do you or together all values of a list in Python?

How do you or together all values of a list in Python? I'm thinking something like: or([True, True, False]) or if it was possible: reduce(or, [True, True, False]) ...

Correct way to write lists

This is something I've pondered over for a while, as I've seen both used in practise. Method 1 <ol> <li>List item 1</li> <li>List item 2 <ol> <li>List item 3</li> </ol> </li> <li>List item 4</li> </ol> This seems semantically correct to me, since the sub-list is a sub-list of that list item...

ArrayList vs List<object>

I saw this reply from Jon on Initialize generic object with unknown type If you want a single collection to contain multiple unrelated types of values, however, you will have to use List<object> I'm not comparing ArrayList vs List<>, but ArrayList vs List<object>, as both will be exposing item of type "object". What would be ...

When to use a linked list over an array/array list?

I use a lot of lists and arrays but I have yet to come across a scenario in which the array list couldn't be used just as easily as, if not easier than, the linked list. I was hoping someone could give me some examples of when the linked list is notably better. ...

How can I process a list of files that includes spaces in its names in Unix?

I'm trying to list the files in a directory and do something to them in the Mac OS X prompt. It should go like this: for f in $(ls -1); do echo $f; done If I have files without spaces in their names (fileA.txt, fileB.txt), the echo works fine. If the files include spaces in their names ("file A.txt", "file B.txt"), I get 4 strings (fil...

Confusing [...] List in Python: What is it?

So I was writing up a simple binary tree in Python and came across [...] I don't believe this to be related to the Ellipsis object, more it seems to have something to do with an infinity loop (due to Python's shallow copy?). The source of this infinity loop and why it doesn't get expanded while expanding when accessed is something I'm c...

How could i create a list in c++?

How can I create a list in C++? I need it to create a linked list. How would I go about doing that? Are there good tutorials or examples I could follow? ...

What is the difference between List (of T) and Collection(of T)?

I've seen them used in a lot of the same ways, and I am worried I'm about to go down a path in design that is irreversible if I don't understand this better. Also, I am using .NET. ...

Extended slice that goes to beginning of sequence with negative stride

Bear with me while I explain my question. Skip down to the bold heading if you already understand extended slice list indexing. In python, you can index lists using slice notation. Here's an example: >>> A = list(range(10)) >>> A[0:5] [0, 1, 2, 3, 4] You can also include a stride, which acts like a "step": >>> A[0:5:2] [0, 2, 4] ...

C# - List<T> or IList<T>

Can anyone explain to me why I would want to use IList over List in C#? Related question: Why is it considered bad to expose List<T> ...

Find() vs. enumeration on lists

Hi all, I'm working with a code base where lists need to be frequently searched for a single element. Is it faster to use a Predicate and Find() than to manually do an enumeration on the List? for example: string needle = "example"; FooObj result = _list.Find(delegate(FooObj foo) { return foo.Name == needle; }); vs. string ne...

uncheckable items in CheckedListBox?

Hi all, In .NET framework, is it possible to set some of the items in the CheckedListBox as "uncheckable" ? I don't want to allow user to check the same items again and add them to a another existing list. I hope I am clear. Thanks in advance. ...

I need help--lists and Python

How to return a list in Python??? When I tried returning a list,I got an empty list.What's the reason??? ...