collections

Is it possible? TCollection descendant to implement storage of TPanel containers with arbitrary content

I'm new to component development in Delphi, therefore want to know, is it possible to implement my task at all. I need to create a visual component (user control) based on TScrollBox, which will represent a bunch of TPanel, all that panels will be aligned as "Top" inside that TScrollBox and can have different Height. It has to act as TC...

How to specify Visual Studio Team Explorer collection on start-up?

This is with VS and TFS 2010. I have multiple TFS servers and multiple collections. When I launch VS, it connects to the "last used" collection. If I had multiple instances of VS open, connected to different collections, whichever exits last appears to "win" as the last used collection. This is annoying. Really what I want is multiple d...

Sorting with collections in java

Hello EveryOne, I have a tricky question in sorting with collection. I have a HashMap which contains some thing like the following HashMap<String,QuoteBean> mapToSort=new HashMap<<String,QuoteBean>(); QuoteBean is basically a java bean which has properties with setter and getter methods Which looks like the following. //class QuoteB...

Can't add null to list of nullables

Possible Duplicate: Adding null to a List<bool?> cast as an IList throwing an exception. List<int?> listONullables = new List<int?>(); IList degenericed = listONullables; // This works fine listONullables.Add(null); // Run time exception: // "The value "" is not of type "System.Nullable`1[System.Int32]" // and cannot be use...

scaladoc for map on Map

According to the scaladoc for the map method on a Map object, it should return a new Map: def map [B] (f: ((A, B)) ⇒ B) : Map[B] "returns a new map resulting from applying the given function f to each element of this map and collecting the results. " But it doesn't: scala> val countries = Map("NO" -> "Norway", "US" -> "Unit...

AS3 <Key,Value> Collection

In actionscript object class can act as a collection that stores key,value combinations: var o:Object = new Object(); o["a"] = 1; But when I'm trying to extend it and add some custom functionality: var mo:MyObject = new MyObject(); mo["a"] = 1; I get this: ReferenceError: Error #1056: Cannot create property a on MyObject. ...

which java collections (and maps) can be sorted by last access

Hi, i know that the LinkedHashMap provides a constructor, where you can indicate if the map should be sorted by the access order thus effectively providing an LRU implementation. Can you tell me which (and if) other Collections and Maps from the big Collections zoo provide this feature? ...

C# getting all colors from Color

I want to make a ComboBox filled with all the colors from System.Drawing.Color But I can't seem to collect all the colors from that collection I've already tried using a foreach to do the job like this: foreach (Color clr in Color) { } But all I get is an error. So how can I loop trough all the colors? Any help will be ...

Finding minimum values of (properties of ) collections in C#

Given the following code from a Microsoft example: public class EngineMeasurementCollection : Collection<EngineMeasurement> { public EngineMeasurementCollection() { Add(new EngineMeasurement { Speed = 1000, Torque = 100, Power = 20 }); Add(new EngineMeasurement { Speed = 2000, Torque = 160, Power = 60 }); ...

Scala for-comprehension returning an ordered map

How can I use a for-comprehension that returns something I can assign to an ordered Map? This is a simplification of the code I have: class Bar class Foo(val name: String, val bar: Bar) val myList: java.util.List[Foo] = ... val result: ListMap[String, Bar] = for { foo <- myList } yield (foo.name, foo.bar) I need to mak...

User Settings: What are my choices?

hello, I'm trying to find out what my choices are when I'm going to use user (persistent) settings. In vs Studio this is possible in the properties of your project but I'm getting to know the limits there: Only values are allowed that can be converted to string. Collections (e.g items in a Listbox, with a name and value) cannot be sa...

Which implementation of List to use?

In my program I often use collections to store lists of objects. Currently I use ArrayList to store objects. My question is: is this a best choice? May be its better to use LinkedList? Or something else? Criteria to consider are: Memory usage Productivity Operations which I need are: Add element to collection Iterate through the...

When querying a collection using linq it always returns a null

When querying a collection using linq it always returns a null Collection<JCTransLabour> oJCTransLabours = null; oJCTransLabour = HttpContext.Current.Session["CurrentLabourTransactions"] as Collection<JCTransLabour>; // at this point the collection oJCTransLabours contains 3500 records var oCurrentL...

What happens if you call the same iterator twice on the same collection?

If I set up an iterator for myList: Iterator iter = myList.iterator(); while(iter.hasNext()) { MyObj myObj = (MyObj)iter.next(); doPrint(myObj.toString()); } And I call it a second time: while(iter.hasNext()) { MyObj myObj = (MyObj)iter.next(); doPrint(myObj.toString()); } Will it go back to the start of the collect...

Filter java.util.Collection in Java

I wrote a util class to filter elements in java.util.Collection as follows: public class Util{ public static <T> void filter(Collection<T> l, Filter<T> filter) { Iterator<T> it= l.iterator(); while(it.hasNext()) { if(!filter.match(it.next())) { it.remove(); } } } } public interface Filter<T> { publ...

Java: Collections.list for iterator / iterable

Hi, Why is java.util.Collections.list only for Enumeration but not for Iterator (or Iterable)? Or why is there not an overload of this function for Iterator (or Iterable)? Is there any other method which does that? Is there any reason why that is? ...

How to refresh WPF chart I'm using to display some data (WPF toolkit chart)

How do you update a WPF chart when the collection changes? I am using WPF chart (System.Windows.Controls.DataVisualization.Toolkit.dllversion version 3.5.50211.1) to plot some simple data. The classes for the data look like this: public class EngineMeasurementCollection : Collection<EngineMeasurement> { } public class EngineMeasure...

Scala Map implementation keeping entries in insertion order?

In Java, I use LinkedHashMap for this purpose. The documentation of Java's LinkedHashMap is very clear that it has "predictable iteration order" and I need the same in Scala. Scala has ListMap and LinkedHashMap, but the documentation on what they do exactly is poor. Question: is Scala's LinkedHashMap or ListMap the implementation to us...

split a java collection into sub collections based on a object property

I have a List of MyObjects ... MyObject{ int id,String name}. Now I want to split the the list into sublists that have identical "id" values, can any one suggest an efficient approach for doing this. ...

comparing the changes in the List and identifying the updated,inserted,deleted objects

enter code hereHi , I have two list one the original data and the second is the list that is edited. Is it possible to get the inserted,deleted and updated object in the list by comparing ? I tried the below and its not working as expected. List<StudentList> originalStudentList = GetStudentsList(); List<StudentList> EditedStudentL...