Possible Duplicates:
c# array vs generic list
Array versus List<T>: When to use which?
I understand that there are several benefits of using List<>. However, I was wondering what benefits might still exist for using arrays.
Thanks.
...
Hi i have a mx:List with a DataProvider. This data Provider is a ArrayCollection if FotoItems
public class FotoItem extends EventDispatcher
{
[Bindable]
public var data:Bitmap;
[Bindable]
public var id:int;
[Bindable]
public var duration:Number;
public function FotoItem(data:Bitmap, id:int, duration:Number, ...
I have a list of dicts:
list = [{'title': u'Politics', 'id': 1L, 'title_url': u'Politics'},
{'id': 3L, 'title_url': u'Test', 'title': u'Test'}]
I'd like to remove the list item with title = 'Test'
What is the best way to do this given that the order of the key/value pairs change?
Thanks.
...
I want to make a component that includes a list of integers as one of its serialized properties. I know I can't declare a TList<integer> as a published property, because it doesn't descend from TPersistent. I've read that you can define "fake" published properties if you override DefineProperties, but I'm not quite sure how that works,...
The following test fails with JRE 1.6.0_20
public void testSetGetTextWithList() throws Exception {
final JEditorPane editorPane = new JEditorPane();
editorPane.setContentType("text/html");
editorPane.setText("<ul><li></li></ul>");
assertTrue(editorPane.getText().contains("<ul"));
}
Of course, there is a visual differen...
Hello,
I need to change a method that has one parameter that takes a serie of objects. I need to find the lowest Interface (in inheritance tree) that has the Count property. Until now I was using the IEnumerable but as this has not Count I need to change it to the wider interface possible so the method can work with the biggest number o...
I would like to apply my function to only elements that are deeper in the list structure.
For example, I would like to apply a certain function to list elements of second order only. Is this feasible with apply()?
> str(l)
List of 3
$ :List of 2
..$ : num 5
..$ : num 10
$ :List of 2
..$ : num 15
..$ : num 20
$ :List of 2
....
I'm trying to find an item in a list of values based on another value using a lambda expression using the Find method. In this example I'm expecting to get back -1000, but for the life of me, I just can't come up with the proper lamda expression. If that sounds confusing I hope the code and comments below explain it better.
TIA.
using S...
Hi,
It's been two years since I last coded something in Java so my coding skills are bit rusty.
I need to save data (an user profile) in different data structures, ArrayList and LinkedList, and they both come from List. I want to avoid code duplication where I can and I also want to follow good Java practices.
For that, I'm trying to ...
Say I have a list val list = List(34, 11, 98, 56, 43).
Now how do I find the index of the minimum element of the list (e.g. 1 in this case)?
...
Hi all
Assuming I have a method which accepts an IList or similar thing as a parameter:
public void JiggleMyList(IList<string> list)...
Is there an easy way that I can pass in string members of a list of objects?
I mean, if for example, I have a list of Person objects which expose a string property called FullName, is there a quick ...
Hi,
I'm new to Java and Groovy and am running into trouble with the following Groovy script. I created this whittled down version of a larger script to facilitate debugging.
The script is iterating through a list trying to calc a running total of the values of all objects in the list. Some or all of these objects' values may be null.
...
Hi,
The following code obviously doesn't work because List<E> is abstract:
public class MyList {
private List<E> list;
public MyList() {
this.list = new List<E>();
}
}
How can I initialize MyList class with an empty constructor if I need the list variable to be a LinkedList or a ArrayList depending on my needs?
...
I have a problem with entity refreshing in NHibernate.
I have an entity with IList property; this property is mapped with "list" tag on hbm mapping file.
Now, on maintenance window if I remove some elements from the list (without saving) and then I call NHibernate refresh to restore changes the list items, that previously I removed, ar...
Hi,
I have this code:
cursor.execute( ''' SELECT id,DISTINCT tag
FROM userurltag ''')
tags = cursor.fetchall ()
T = [3,5,7,2,1,2,2,2,5,6,3,3,1,7,4]
I have 7 groups names 1,...,7 . Each row in "tags" list corresponds to a row in "T" list.the values of "T" say that for example the first row in "tags" list belongs t...
I want to divide a list in "a specific number of" sublists.
That is, for example if I have a list List(34, 11, 23, 1, 9, 83, 5) and the number of sublists expected is 3 then I want List(List(34, 11), List(23, 1), List(9, 83, 5)).
How do I go about doing this? I tried grouped but it doesn't seem to be doing what I want.
PS: This is no...
Hi,
Performance wise, is there really a big difference between using:
ArrayList.contains(o) vs foreach|iterator
LinkedList.contains(o) vs foreach|iterator
Of course, for the foreach|iterator loops, I'll have to explicitly compare the methods and return true or false accordingly.
The object I'm comparing is an object where equals() ...
I'm a bit fuzzy on the best way to solve the problem of needing a list for each of my business objects that implements some overridden functions.
Here's the setup:
I have a baseObject that sets up database, and has its proper Dispose() method
All my other business objects inherit from it, and if necessary, override Dispose()
Some of th...
how to concatenate all content of list in on one string in c#?
...
I have two ordered lists next to each other.
When I take a node out of one list I want to insert it alphabetically into the other list. The catch is that I want to take just the one element out and place it back in the other list without refreshing the entire list.
The strange thing is that when I insert into the list on the right, it...