I need to create an object which exposes an IDictionary<K,V> interface, but I don't want to fill in the entire interface implemntation.
It would be nice to have the equivalent of Java's AbstractDictionary, which leaves you very little to impelment a complete dictionary (HashMap, in Java):
If you don't need to iterate the collection, y...
Did you know that :
Map<Object,Object> m1 = new HashMap<Object, Object>();
Map<Object,Object> m2 = new HashMap<Object, Object>();
System.out.println("m1.equals(m2) = "+m1.equals(m2));
System.out.println("m1.keySet().equals(m2.keySet()) = "
+m1.keySet().equals(m2.keySet()));
System.out.println("m1.entrySet().equals(m2.entrySe...
I'm having an issue with an ObservableCollection getting new items but not reflecting those changes in a ListView. I have enough quirks in the way I'm implementing this that I'm having a hard time determining what the problem is.
My ObservableCollection is implemented thusly:
public class MessageList : ObservableCollection<LobbyMessag...
I'm a relatively new Java programmer coming from C++/STL, and am looking for a class with these characteristics (which the C++ std::deque has, as I understand it):
O(1) performance for insertion/removal at the beginning/end
O(1) performance for lookup by index
are growable collections (don't need fixed size bounds)
Is there a Java eq...
Is there a generic container implementing the 'set' behaviour in .NET?
I know I could just use a Dictionary<T, Object> (and possibly add nulls as values), because its keys act as a set, but I was curious if there's something ready-made.
...
Hi, I have a collection of orders. I would like to hit the database once, retrieve the orders, store them and then be able to access this collection over multiple forms. I know in asp.net, you can use things like Application Object or Session Object but how do you do it in a win form app? I was thinking of creating a static collection th...
Hi,
we are randomly seeing this error during long executions of our system. The error is caught by our alarm system, and we successfully retry, and continue running the system. The only hits we found on Google seem to mention corrupt installations. We do not think this is the case here, since our systems is running, gets the error, and c...
What is the difference between ArrayList and List in VB.NET
...
I needed a generic collection or list that can fire an event when an item is added or removed.
I discovered that BindingList(of T) has events for this and wired up a quick proof of concept that worked fine.
Of course, this doesn't feel like the most educated choice; BindingList is overkill for what I'm doing. Are there any simpler col...
I think in something like this:
public static <T extends Comparable<T>> T minOf(T...ts){
SortedSet<T> set = new TreeSet<T>(Arrays.asList(ts));
return set.first();
}
public static <T extends Comparable<T>> T maxOf(T...ts){
SortedSet<T> set = new TreeSet<T>(Arrays.asList(ts));
return set.last();
}
But is not null s...
I have unsorted map of key value pairs.
input = {
"xa" => "xavalue",
"ab" => "abvalue",
"aa" => "aavalue",
"ba" => "bavalue",
}
Now I want to sort them by the key and cluster them into sections by the first character of the key. Similar to this:
output1 = {
"a" => {
"aa" => "aavalue",
"ab" => "abvalue",
},
...
I have a class that contains a list of objects. What's the best way to run some code in the class when the list is modified?
class MyManagerClass
{
ArrayList list = new ArrayList(); // will likely be a different collection class
private OnItemAddedToList(object o)
{
// how to call this?
}
private OnItemRemov...
How do I append the contents of one list at the end of another list?
...
I'm using .Net 2.0 and this is driving me crazy but there's probably some easy thing I'm not doing that I am now too confused to see.
I have an application that has a bespoke collection of objects in it, only the main form should be able to change the contents of that collection and all other forms should be able to read from it.
Actu...
When I have entities in my domain with lists of things, should they be exposed as ILists or IEnumerables? E.g. Order has a bunch of OrderLines.
...
I'm working in two different Oracle schemas on two different instances of Oracle. I've defined several types and type collections to transfer data between these schemas. The problem I'm running into is that even though the type have exactly the same definitions (same scripts used to create both sets in the schemas) Oracle sees them as ...
I ran into this today when unit testing a generic dictionary.
System.Collections.Generic.Dictionary<int, string> actual, expected;
actual = new System.Collections.Generic.Dictionary<int, string> { { 1, "foo" }, { 2, "bar" } };
expected = new System.Collections.Generic.Dictionary<int, string> { { 1, "foo" }, { 2, "bar" } };
Assert.AreEqu...
Why is the compiler unable to infer the correct type for the result from Collections.emptySet() in the following example?
import java.util.*;
import java.io.*;
public class Test {
public interface Option<A> {
public <B> B option(B b, F<A,B> f);
}
public interface F<A,B> {
public B f(A a);
}
public ...
I have a WPF ListBox bound to a data object. Inside the listbox are a series of images with text. It is layed out in a horizontal fashion, and mousing over the left or right sides of the box scroll the items left or right respectively.
let's say there are 20 items in the listbox. I'm trying to figure out how when I hit position 19 item ...
I need to sort some objects according to their contents (in fact according to one of their properties, which is NOT the key and may be duplicated between different objects)
.net provides two classes (SortedDictionnary and SortedList), and both are some kind of Dictionaries. The only difference (AFAIK) is that SortedDictionnary uses a bi...