collections

Need help sorting mulitple NSMutableArrays

I have high scores (name, score, time) stored in a single file and I divide them into separate arrays once it reads them, only problem is i cant figure out a way to sort all three by score and time from least to greatest and still keep the correct order of values. For example: Name score time --------------- nathan 123 01:12 bob 321 ...

Struts2: Radiobutton, Iterations and List trouble

Hi at all... I have a complicated problem and I hope to explain it clearly possible... I have 2 list. On my jsp I have a nested iteration with this 2 lists, inside this there is a tag. This is the code: <s:iterator value="listSurveyToRender" var="s" status="counterS"> <s:iterator value="listSurveyValuesToRender" va...

silverlight 3 collection binding

Someone please help me understand why this binding does not work... I have a class called SelectionManager with a property called 'dates' which is populated by a WCF service. The property is an array of structs which bundles a DateTime and an integer count of business objects. public class SelectionManager : INotifyPropertyChanged {...

Casting generic collection to concrete implementation in C# 2.0.

Chosen Solution Thanks for the help everyone. I've decided to do the following. public static class PersonCollection { public static List<string> GetNames(RecordCollection<Person> list) { List<string> nameList = new List<string>(list.Count); foreach (Person p in list) { nameList.Add(p.Name)...

Unmodifiable lists in C#

In Java, one can use the Collections#unmodifiableList() method to create an unmodifiable list from an existing List object. Is there any counterpart in C# ? I'm new to the language and haven't been able to find anything like this in the MSDN docs. ...

PLSQL Collections - how to use table of records?

I'm new to PL/SQL and I'm trying to use a table of records, but I don't know how to use this feature. What is the problem? DECLARE TYPE TIP IS RECORD ( F1 SMALLINT, F2 SMALLINT); TYPE Ve IS TABLE OF TIP; v ve; IND SMALLINT := 0; BEGIN WHILE(IND<20) ...

Converting Java Collection of some class to Collection of String

Assume a class (for instance URI) that is convertable to and from a String using the constructor and toString() method. I have an ArrayList<URI> and I want to copy it to an ArrayList<String>, or the other way around. Is there a utility function in the Java standard library that will do it? Something like: java.util.collections.copy(u...

Java lists -- does LinkedList really perform so poorly vs ArrayList and TreeList?

Taken from Apache TreeList doc: The following relative performance statistics are indicative of this class: get add insert iterate remove TreeList 3 5 1 2 1 ArrayList 1 1 40 1 40 LinkedList 5800 1 350 2 325 It goes on to say, "LinkedList is rarel...

Pl/SQL: How to sort a table of records?

I'm new to pl/sql ! I'm trying to sort a table of records, using a simple bubble-sort algorithm. What is the problem? Where could I find more information about using table of records ? DECLARE text VARCHAR2(50); TYPE TIP_VECTOR IS TABLE OF INT INDEX BY BINARY_INTEGER; TYPE contorRecord IS record ( codASCII VARCHAR2...

scala 2.8 breakout

In Scala 2.8, there is an object in scala.collection.package.scala: def breakOut[From, T, To](implicit b : CanBuildFrom[Nothing, T, To]) = new CanBuildFrom[From, T, To] { def apply(from: From) = b.apply() ; def apply() = b.apply() } I have been told that this results in: > import scala.collection.breakOut > val map : Map[Int,...

clear() methods in Java

Many of the container type data structures in Java come with a clear() method. For example, we can call clear() on a Vector we want to clear out all the contents in the Vector. My question is after applying the clear() method, does the content in the vector get nulled out or are they still being referenced? Thanks. ...

NHibernate: Remove an Item From a Persisted Collection Automatically

Using NHibernate, I am looking for a way to automatically update persisted collections when a persisted item is deleted. For instance: var post = GetNewPost(); var blog = GetCurrentBlog(); blog.Posts.Add(post); BlogRepository.Update(blog); User.Posts.Add(post); UserRepository.Update(user); ---- // Somewhere else var blog = GetCurrent...

primitive multimap in java with good (insert, iteration) performance characteristics

I'm doing some heavy processing (building inverse indices) using ints/ longs in Java. I've determined that (un)boxing of standard java.collections maps takes a big portion of the total processing time. (as compared to a similiar implementation using arrays, which I can't use due to memory constraints). I'm looking for a fast 3rd-part...

Scala 2.8 collections design tutorial

Following on from my breathless confusion, what are some good resources which explain how the new Scala 2.8 collections library has been structured. I'm interested to find some information on how the following fit together: The collection classes/traits themselves (e.g. List, Iterable) Why the Like classes exist (e.g. TraversableLike) ...

Is the Scala 2.8 collections library a case of "the longest suicide note in history" ?

First note the inflammatory subject title is a quotation made about the manifesto of a UK political party in the early 1980s. This question is subjective but it is a genuine question, I've made it CW and I'd like some opinions on the matter. Despite whatever my wife and coworkers keep telling me, I don't think I'm an idiot: I have a goo...

A good collection to use when binding to a DataGridView in C#.

What would be the best collection to use when binding a list of data to a DataGridview in C#? I'm currently using just a Generic List but the data grid doesn't update when there is objects added or removed from the list. I've looked at using a BindingList or a ObservableCollection, but can't decide which would be best to use that would...

Templated user control question - Collection of multiple object types

I am planning on creating a templated user control to allow for the following markup. <myCustomControl id="myCustomControl" runat="server"> <testObjects> <addPredefinedObject name="test1" /> <addPredefinedObject name="test2" /> <addCustomObject id="1" /> <addPredefinedObject name="test3" /> <addCustomObjec...

How to merge multiple ControlCollections in C#?

Is there an elegant way of doing this? Perhaps with Linq? For something like this: List<ControlCollection> list = { ... } List<Control> merged = list.MergeAll(); EDIT: The final collection will be single dimensional in a sense that all controls will be there, not in a nested way. ...

Is there a limit of elements that could be stored in a List ?

Is there a limit of elements that could be stored in a List ? or you can just keeping adding elements untill you are out of memory ? ...

XStream avoid collection xml element

Given a List of POJO's, if I serialize them with XStream I get: <list> <pojo> <a>a</a> <b>b</b> </pojo> <pojo> <a>a</a> <b>b</b> </pojo> </list> How can I do the serialization and omit the <list> </list> entries? I've used addImplicitCollection for a similar purpose but that was to omit the collection inst...