Given a java.util.Collection what is the easiest way to create an endless java.util.Iterator which returns those elements such that they show up according to a given distribution (org.apache.commons.math.distribution)?
...
Hi!
Suppose We have a, IEnumerable Collection with 20 000 Person object items.
Then suppose we have created another Person object.
We want to list all Persons that ressemble this Person.
That means, for instance, if the Surname affinity is more than 90 % , add that Person to the list.
e.g. ("Andrew" vs "Andrw")
What is the most effec...
Say I have a rolling collection of values where I specify the size of the collection and any time a new value is added, any old values beyond this specified size are dropped off. Obviously (and I've tested this) the best type of collection to use for this behavior is a Queue:
myQueue.Enqueue(newValue)
If myQueue.Count > specifiedSize Th...
I'm completely new to GUI programming and need a little help with a list of pictureboxes.
The idea is that I have a list of pictureboxes. When a user clicks on one I want to (for example) change the BorderStyle property of the one selected to be Fixed3D, but change the remaining collection borders to FixedSingle (or something like that...
Any cheatsheet available for Collection and Generics in C# 3.0 or 3.5 ?
...
Just i started learning Collection and Generics in C# .I visited MSDN resource page.It directed me to lot of sub pages ,i was going page after page,finally got confused.
Can anybody help me where to start and what are the essential things to learn bot about collection (non-generics) and generics?.
MSDN articles are dragging me by putti...
I have a java properties file containing a key/value pair of country names and codes. I will load the contents of this file into a Collection like List or HashMap.
Then, I want users to be able to search for a country, e.g if they type 'Aus' in a textbox and click submit, then I want to search through the collection I have, containing a...
I want to iterate over a treeMap, and for all 'key's which have a particular value, I want them to be added to a new TreeMap. How can i do this? Code samples would be prefered.
...
Hello,
I am looking for a solid implementation of an ordered associative array (in terms of keys, not of insertion order).
More precisely, I am looking for a space-efficent implementation of a int-to-float (or string-to-float for another use case) mapping structure for which:
Ordered iteration is O(n)
Random access is O(1)
The bes...
Hi,
Is it possible to group OracleCommand objects and iterate through each OracleCommand in the collection?
Could someone post a sample code in achieving this?
Thanks.
Angelo
...
I am using StringDictionary collection to collect Key Value Pairs.
Ex :
StringDictionary KeyValue = new StringDictionary();
KeyValue.Add("A", "Load");
KeyValue.Add("C", "Save");
During retrieval i have to form two foreach to get keys and Values (i.e)
foreach(string key in KeyValue.Values )
{
...
}
foreac...
I have a single table with a hierarchy inside. I am using ActiveRecord. How can I convert this into a hierarchic collection that I can then bind to a WinForms or WPF treeview?
Thanks.
ID Name ParentID
1 ALL 1
2 ARGENTINA 1
15 AUSTRALIA 1
16 NW 15
17 BLACKTOWN 16
18 CORLETTE 16
19 PRIMBEE 16
20 TWEED HEADS 16
21 QL 15
22 AS...
I want to store an list of key value pair lists in a lightweight structure. This seems too cumbersome. What's better? Does List<Dictionary<string, string>> add much a overhead? What other options are available?
...
I have a concrete class that contains a collection of another concrete class. I would like to expose both classes via interfaces, but I am having trouble figuring out how I can expose the Collection<ConcreteType> member as a Collection<Interface> member.
I am currently using .NET 2.0
The code below results in a compiler error:
Canno...
I have an abstract base class
class AbstractClass
{
Col<AbstractClass> parent
public AbstractClass()
{
//do stuff
}
}
I have two implementations
class A : AbstractClass
{
Col<A> parent
public A(Col<A> parent)
:base(parent)
{
this.parent = parent;
}
}
class B : AbstractC...
What's the quickest way to remove an element from a Map by value in Java?
Currently I'm using:
DomainObj valueToRemove = new DomainObj();
String removalKey = null;
for (Map.Entry<String, DomainObj> entry : map.entrySet()) {
if (valueToRemove.equals(entry.getValue())) {
removalKey = entry.getKey();
break;
}
}
if (remova...
Hi
I have a observable collection as follows....
I used to get designer ignorable error as "type(0) does not support direct content" due to which I implemented ContentProperty as shown below... but now I get two unavoidable errors at the designer as
1.The object 'CustomDataGridColumnCollection' already has a child and cannot add 'Da...
I have a list of User objects, and I have to remove ONE item from the list with a specific UserID.
This method has to be as fast as possible, currently I am looping through each item and checking if the ID matches the UserID, if not, then I add the row to a my filteredList collection.
List allItems = GetItems();
for(int x = 0; x < all...
Is anyone aware of a generic tree (nodes may have multiple children) implementation for Java? It should come from a well trusted source and must be fully tested.
It just doesn't seem right implementing it myself. Almost reminds me of my university years when we were supposed to write all our collections ourselves.
EDIT: Found this pro...
I am looking for an efficient sql backed collections library, for the Java programming language.
I need to do database manipulations that fit very well the Collections API, is there something that can be a good bridge for that, or must I roll my own thing.
...