Hi,
I'm having issues with concurrent usage of a shared collection with a multi-player synchronous game I'm working on. I did some digging around and found a neat thread-safe IEnumerator/IList implementation on Alexey Drobyshevsky's post on codeproject here:
http://www.codeproject.com/KB/cs/safe_enumerable.aspx
After adopting his impl...
Let's say I have an array of primitives or a list of objects, doesn't matter, is there a short way of doing this kind of check:
if (a_primitive == any_item_in_my_collection) {
// do something
}
or
if (an_object_ref.equals(any_item_in_my_collection)) {
// do something
}
without doing this
for (int i = 0; i < myArray.length;...
I need a collection that behaves as Set and preserves order of element insertion.
Is there one or I'll have to implement it myself?
What would the best implementation be?
...
I am currently working on a programming related problem where I am attempted to make a massive hashmap of data. The key for the data is a custom low-memory implementation of a CharSequence that implements hashCode() and equals(...) and the value is am Integer object.
There may be millions of entries in this hashtable and I managed to d...
What is the optimal approach to a WithEvents Collection - VB.NET?
Have you any remarks on the code bellow (skipping the Nothing verifications)?
The problem is when I obtain the LinkedListNode(Of Foo) in a For Each block I can set
myNode.Value = something, and here is a handlers leak...
-Could I override the FooCollection's GetEnumera...
Hello,
I want to change the field title to integer max value 21......... not 200 chars only.
When I change the value 200 of Size and confirm OK button a 2nd Dataset1.designer file is created and I get a lot of duplicate variable errors... I already changed the value in the designer and saved everything ok, but when I check again the ...
We are dynamically building some SQL statements and we are utilizing the IN operator. If our value is a collection of values such that:
List<Guid> guids = new List<Guid>()
I want to be able to provider 'guids' to my clause builder, have it verify the type and if it is enumerable create a clause like:
IN ( {Guid1}, {Guid2}, {Guid3} )
...
I'm not looking for how, I'm looking for why? I couldn't find a straight forward answer to this.
...
I am trying to write a program that has a vector of char arrays and am have some problems.
char test [] = { 'a', 'b', 'c', 'd', 'e' };
vector<char[]> v;
v.push_back(test);
Sorry this has to be a char array because I need to be able to generate lists of chars as I am trying to get an output something like.
a a
a b
a c
a d
a e
b a
b...
Hi,
I have a Map that uses a Set for the key type, like this:
Map<Set<Thing>, Val> map;
When I query map.containsKey(myBunchOfThings), it returns false, and I don't understand why. I can iterate through each key in the keyset and verify there is a key that (1) has the same hashCode, and (2) is equals() to myBunchOfThings.
System.out...
I have text documents like the following which contain single and multiple variables:
title:: Report #3
description:: This is the description.
note:: more information is available from marketing
note:: time limit for this project is 18 hours
todo:: expand the outline
todo:: work on the introduction
todo:: lookup footnotes
I need to it...
So I'm working on rewriting a program for a professor, and I have some questions related to the Model-View-Controller pattern. The program is called GraphViewer and is used to design and view graphs (as in Graph Theory, not Statistics). So far I have planned the structure thus:
Models
VertexModel - Has id, location, color, and a col...
What I need is a collection where i can specify the max number of elements. If i try to insert an element and the collection is full. The first element in the collection is removed, so that it does not overflow.
Is there such an object in .net or do i have to make it myself?
...
Hi guys, got a few questions
i have initialised my collection with a few objects, how do i set the make etc when i initialise them (i have the set methods). So in the line below where would i put setMake()? would it work with a . accesor after LargePlane?
planesAvailable.put("502146", new LargePlane());
Im also having a problem with w...
Hi guys,
I've got two objects: User and Permission, where User has a Collection. In my "create" service, I read a bunch of Permissions, put them in a HashSet, add them to the user, and create the user using my DAO that says
((SessionFactory) sessionFactory).getCurrentSession().save(user);
When I look in my object, all looks fine, bu...
I'm a little confused about how to do something in HQL.
So let's say I have a class Foo that I'm persisting in hibernate. It contains a set of enum values, like so:
public class Foo
{
@CollectionOfElements
private Set<Bar> barSet = new HashSet<Bar>();
//getters and setters here ...
}
and
public enum Bar
{
A,
B
}...
I have read that LinkedHashMap has faster iteration speed than HashMap because its elements are doubly linked to each other. Additionally, because of this, LinkedHashMap is slower when inserting or deleting elements. Presumably because these links also need to be updated.
Although I can see an analogy to LinkedList vs ArrayList, in that...
I have started using BindingList(Of T) for my generic collections whenever I need the objects to interface with the GUI instead of List(Of T). This has worked well for me so far but a few of my collections are stored in Dictionary(Of TKey, TValue) and there doesn't appear to be a corresponding BindingDictionary(Of T).
Has anyone else co...
If I wanted to have a collection that described the (recursive) contents of a root directory, including directories and files, how would I store them? Or do I need to come up with an object that holds:
-Current directory
-Parent directory
-Files in directory
..and slap them all in one big list and manually work out the relationship at r...
Let's say I have a collection of objects which can be sorted using a number of different comparators based on the different fields of the object.
It would be nice to be able to know later on in the code which comparator was used to sort the Collection with and if it was ascending or descending. Is there anyway to do this elegantly instea...