collections

How can I create a collection of references in C#

Ok I am having a cross language hiccup. In C# with it's great collections like List and I have: a Map class with properties of: List<byte[]> Images; List<Tile> Tiles; a Tile Class of: byte[] ImageData; int X; int Y; Now I want to add an image to the Map class and have the ImageData property of the Tile Classes to ...

Find messages from certain key till certain key while being able to remove stale keys.

My problem Let's say I want to hold my messages in some sort of datastructure for longpolling application: 1. "dude" 2. "where" 3. "is" 4. "my" 5. "car" Asking for messages from index[4,5] should return: "my","car". Next let's assume that after a while I would like to purge old messages because they aren't useful anymore and I want...

Adding to an Array

Hi All I have an array: String[] ay = { "blah", "blah number 2" "etc" }; ... But now I want to add to this array at a later time, but I see no option to do so. How can this be done? I keep getting a message saying that the String cannot be converted to String[]. Thank you ...

Getting a java collection of objects in Alphabetical order

I have a question that I dont really know where to start. So I thought i'd ask it here. Basically, I have a drop down with names in it. I want these names to be in alphabetical order. Populating the drop down happens as follows; I query a database and pull down an Id and Name, make a object called "UserList", and set the name and id v...

How does Concat() actually join the collections at lower level?

What is Linq actually doing? ...

Sorting in Hash Maps in Java

I'm trying to get familiar with Collections. I have a String which is my key, email address, and a Person object (firstName, lastName, telephone, email). I read in the Java collections chapter on Sun's webpages that if you had a HashMap and wanted it sorted, you could use a TreeMap. How does this sort work? Is it based on the compare...

Best data-structure to use for two ended sorted list

I need a collection data-structure that can do the following: Be sorted Allow me to quickly pop values off the front and back of the list O(log n) Remain sorted after I insert a new value Allow a user-specified comparison function, as I will be storing tuples and want to sort on a particular value Thread-safety is not required Optiona...

Passing a comparator syntax help in Java

I've tried this a couple ways, the first is have a class that implements comparator at the bottom of the following code. When I try to pass the comparat in sortListByLastName, I get a constructor not found error and I am not sure why import java.util.*; public class OrganizeThis implements WhoDoneIt { /** Add a person to the ...

Writing a synchronized thread-safety wrapper for NavigableMap

java.util.Collections currently provide the following utility methods for creating synchronized wrapper for various collection interfaces: synchronizedCollection(Collection<T> c) synchronizedList(List<T> list) synchronizedMap(Map<K,V> m) synchronizedSet(Set<T> s) synchronizedSortedMap(SortedMap<K,V> m) synchronizedSortedSet(SortedSet<T...

C# Generic Collection help

I have a requirement to implement some kind of dictionary object. Something like MyDict<K,V1, V2). For example if I have a Question as Key(k) then Correct answer is V1 . V2 is user selected answer. Is there a collection that would satisfy this requirement in C#. If I have to design my own type, what interfaces should I implement. ICollec...

Choosing design method for ladder-like word game.

I'm trying to build a simple application, with the finished program looking like this : I will also have to implement two different GUI layouts for this. Now I'm trying to figure out the best method to perform this task. My professor told me to introduce Element class with 4 states : - empty - invisible (used in GridLayout) - first le...

Explaining verity index and document search limits

As present, we currently have a CF8 standard edition server which have some limitations around verity indexing. According to Adobe Verity Server has the following document search limits (limits are for all collections registered to Verity Server): - 10,000 documents for ColdFusion Developer Edition - 125,000 documents for ColdFusio...

how to selectively filter items in a collection

I use the following snippet to filter the list of selected users, where isSelected is a boolean variable. Is there a simpler way (helper function) to populate the selectedUsers collection instead of writing the following lines of code. List<User> selectedUsers = new ArrayList<User>(0); for (User user : this.getUsers()) { if (user.is...

Is there a collection in .Net that supports sorted values only. Keys are not needed?

I am looking for something like a tree. We are constantly inserting into an already sorted collection. We would like access to the minimum and maximum value. We don't need any keys, just the value. I couldn't find any tree structures from .Net and I couldn't see any thing else that looked like what I am looking for. ...

How created method with signature as List

Hi all, I'm very new to Java programming language so this is probably dumb question but I have to ask it because I can't figure it out on my own. Here is the deal. I want to create method which extracts certain object type from a list. So the method should receive List as argument, meaning list should contain either Object1 or Object2....

How to pass data from VB.NET to ActiveX.exe?

I've created a MAPI Wrapper in VB6 and compiled it as an ActiveX.exe so I can use it in my VB.NET project. The project is a windows service that takes data from a webservice passes data to activex.exe and it creates public folder records in exchange 2003. I was wondering if anyone know how I could pass a collection to my activex.exe? ...

Self-updating collection concurrency issues

I am trying to build a self-updating collection. Each item in the collection has a position (x,y). When the position is changed, an event is fired, and the collection will relocate the item. Internally the collection is using a “jagged dictionary”. The outer dictionary uses the x-coordinate a key, while the nested dictionary uses the y-...

WPF How to bind to a specific element in the Collection

Hi, I want to make a binding to a specific element in the Collection. But I cannot figure out how to write the Binding. This is the code: public class MySource { .. public string SomeProp; public ICollection<T> MyCollection; .. } this.DataContext = new MySource(); <TextBox Text={Binding SomeProp} /> <TextBox Text={Binding FIRST_...

for (Object object : list) [java] construction

My question, is, whether the sequence of elements picked from a list will always be the same, is this construction behaviour is deterministic for java "List"s - descendants of java.util.List 2) question, if I use for(Object o: list) construction and inside the loop's body increment a variable, will it be the index of li...

document.getElementById('').length = 0 doesn't work under Win7

I have a select list: <select id="sel"> <option>text1</option> <option>text2</option> <option>text3</option> <option>text4</option> </select> I want to delete all items, without for loop. I tried: document.getElementById('sel').length = 0; But this doesn't work in some browsers. Any ideas? Thanks ...